Thursday, August 5, 2010

run PYTHON (no-script) to provide a CGI supported HTTP Server

want HTTP Server with CGI Support, just need PYTHON without any scripts

so to have CGI supported HTTP server, just by using PYTHON, you need to follow below steps

opening shell/command-prompt

$>cd (change dir) to directory you want to be root of your server

create a directory name 'cgi-bin' or 'htbin', say "mkdir cgi-bin"

copy all your CGI-scripts to this newly created 'cgi-bin' directory

now if anyhow you changed your directory, change it back to Parent Dir of created dir 'cgi-bin'

now run this command without quotes 
"python -m CGIHTTPServer"

Finally, [ Say yyippppeeeee... ] Thanks...

now you have a CGI supported Simple HTTP Server running, that can be accessed at Port 8000 of your Server's IP/Name

so you can test it by browsing in any web browser at http://YOUR_SERVER_IP:8000/
and like if you copied any script 'time' to cgi-bin then its accessible at http://YOUR_SERVER_IP:8000/cgi-bin/time

1 comment:

  1. BlueHost is ultimately the best website hosting provider with plans for any hosting needs.