Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like a dead-simple web/file server (ideally, something no more complicated than "run this command with these flags") which also allows specifying mime-types based on file extensions. Something like this would be great:

my-file-server --root=path/to/files --additional-mime-types="foo|text/plain"

Does this exist? What are my options? If not, what's the next best thing?

This is in a Linux environment, and I'm only serving the files on localhost.

share|improve this question
add comment

6 Answers 6

up vote 2 down vote accepted

What about lighttpd? Can't remember if it has commandline capabilities though. It does have a conf file for mime types if I recall.

share|improve this answer
add comment

The dead simple server: python -m SimpleHTTPServer will set up a webserver on http://127.0.0.1:8000 serving content in the CWD

as far as mimetypes, i think it sets something up from http://docs.python.org/library/mimetypes.html it wouldn't be hard to write a script that uses http://docs.python.org/library/mimetypes.html and mimetypes.init() or mimetypes.read_mime_types() to get the mimetype mappings you need. You can get an example 'web server script' from http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python and use that framework to add your mimetype loads someplace in the script.

share|improve this answer
add comment

I would go with apache. It is free, it runs on Windows and Linux, it will run all of the mimi types you require and there is a TON of documentation out on the web for it. I have run (am running) Apache on a Windows / Linux environment that hosts a web mail client for my IMAP mail server. Works flawlessly!

Danbo

share|improve this answer
    
That's not at all what I would consider simple. To properly run Apache you typically privileged access and must juggle a number of mental constructs. I just want to run a file server with some mime-types configuration, something like serve-this --mime-mapping="foo|text/plain" --root=path/to/site. –  John Feminella Oct 6 '10 at 14:23
    
Most default installations of apache are quite secure and run out of the box. Other than determining where to put your files it is very set and forget. The complexity is there if you want to add features. –  BillThor Oct 6 '10 at 14:37
    
I agree will BillThor. John, you are right it can be very complicated, but not out of the box. I have configured web servers in windows where all I had to was run the install file and change a couple of things in the config file and that was it.... –  danbo Oct 6 '10 at 17:41
add comment

You don't say what operating system you are using, but I would recommend IIS if you're running Windows. The administration interface is very easy to use.

share|improve this answer
    
Running IIS seems a bit overkill. I'm thinking something closer to Webrick, ADSF, etc., where no additional configuration is required other than set-it-and-forget-it. –  John Feminella Oct 6 '10 at 14:27
add comment

Ubuntu server can have a LAMP server up in about 5 minutes. You can configure the mime types in the /etc/apache2/mods-available/mime.conf file.

share|improve this answer
add comment

Mongoose can do that:

mongoose -extra_mime_types .txt=text/html,.blah=application/foo
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.