What is the simplest web server I can operate which also allows configuring mime-types?

1

1

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.

John Feminella

Posted 2010-10-06T14:14:53.977

Reputation: 1 582

Answers

2

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

ricbax

Posted 2010-10-06T14:14:53.977

Reputation: 4 894

3

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.

Rich Homolka

Posted 2010-10-06T14:14:53.977

Reputation: 27 121

0

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

danbo

Posted 2010-10-06T14:14:53.977

Reputation: 658

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 – 2010-10-06T14:23:12.583

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 – 2010-10-06T14:37:27.680

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 – 2010-10-06T17:41:21.270

0

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.

Nick

Posted 2010-10-06T14:14:53.977

Reputation: 981

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 – 2010-10-06T14:27:04.133

0

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.

Daemon of Chaos

Posted 2010-10-06T14:14:53.977

Reputation: 178

0

Mongoose can do that:

mongoose -extra_mime_types .txt=text/html,.blah=application/foo

valenok

Posted 2010-10-06T14:14:53.977

Reputation: 131