deploying web.py with nginx and mod_wsgi

It is possible to deploy web.py with nginx using a mod_wsgi similar to the module for Apache.

After compiling and installing nginx with mod_wsgi, you can easily get a web.py app up and running with the following config* (edit the paths and settings with your own):

  1. wsgi_python_executable /usr/bin/python;
  2. server {
  3. listen 80;
  4. server_name www.domain_name.com domain_name.com;
  5. root /path/to/your/webpy;
  6. include /etc/nginx/wsgi_vars;
  7. location / {
  8. wsgi_pass /path/to/your/webpy/app.py;
  9. }
  10. }

*Note: This is a snippet of the relevant information to setup mod_wsgi for your web app and NOT a full config for running nginx.

Helpful links: nginx website wiki page on mod_wsgi