Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To serve static content of a directory over http, one can simply navigate to that directory and type:

python -m SimpleHTTPServer 11111

which will start a http server on port 11111.

This hack is nice because it requires zero-config: no stand-alone web server, no config files at all.

Is it possible to extend this example, or have an alternate way to achieve this goal, but also have CGI support?

The final goal is to have a quick and lazy way of serving a web site from a certain directory. The site has static content (HTML pages, images), but also a CGI script. The CGI script must work properly when accessed via browser.

Of course I could setup a virtual host in apache, allow CGI inside it etc. But that's not a zero-config approach.

share|improve this question
up vote 0 down vote accepted

You mean like CGIHTTPServer?

share|improve this answer
Excellent! The only tweak I had to do was to create a cgi-bin subdirectory and move the cgi script there, to match the defaults of CGIHTTPServer. – halp Jun 7 '10 at 14:30

Your Answer


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.