2

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.

6 Answers 6

3

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

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.

0
1

Mongoose can do that:

mongoose -extra_mime_types .txt=text/html,.blah=application/foo
1
  • tks, this is quick
    – Dan D.
    Jun 6, 2021 at 16:25
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

3
  • 1
    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. Oct 6, 2010 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, 2010 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, 2010 at 17:41
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.

1
  • 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. Oct 6, 2010 at 14:27
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .