Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
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.