So, I wanted to host a small project made in web.py on my current server. I am running lighttpd as my HTTP server.
The process to set it up is pretty straight forward as explained in the webpy documentation.
I am writing this how-to to cover a couple of things which I didn’t find well documented and had to search around a lot to find
- To get web.py running with lighttpd and fastcgi you need to install the package flup. In debian it is known as python-flup.
- On this server, I run php based sites as well so I had to setup fastcgi for both. Here’s what the code looks like:
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php5-cgi",
"socket" => "/tmp/php.socket",
"max-procs" => 1,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "1000"
)
)),
"/code.py" => (("socket" => "/tmp/fastcgi.socket","bin-path" => "/path-to/webpy-app/code.py","max-procs" => 1,"bin-environment" => ("REAL_SCRIPT_NAME" => ""),"check-local" => "disable")))
- To use web sockets instead of unix sockets change
"socket" => "/tmp/fastcgi.socket",
to
"host" => "127.0.0.1","port" => "8081",