OK, here's my fab def() and nginx.conf (configured for one static directory in app "init"). You can either reproduce the steps manually as listed in the fabfile or put it in your fabfile (much easier!). If you're not familiar with Fabric, most commands are preceded with a "cd" command because each command is discrete and you cannot rely on staying in the same directory.
Credit: http://library.linode.com/web-servers/nginx/python-uwsgi/ubuntu-10.04-lucid The two init.d files are: https://library.linode.com/web-servers/nginx/installation/reference/init-deb.sh https://library.linode.com/web-servers/nginx/python-uwsgi/reference/init-deb.sh (must edit "OWNER=www-data") === fabfile.py === def setup_nginx(): sudo('apt-get -y install build-essential psmisc python-dev libxml2 libxml2-dev python-setuptools') sudo('cd /opt; wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz') sudo('cd /opt; tar -zxvf uwsgi*') sudo('mv /opt/uwsgi*/ /opt/uwsgi/') sudo('cd /opt/uwsgi/; python setup.py install') sudo('chown -R www-data:www-data /opt/uwsgi') sudo('touch /var/log/uwsgi.log') sudo('chown www-data /var/log/uwsgi.log') sudo('apt-get -y install libpcre3-dev build-essential libssl-dev') sudo('cd /opt; wget http://nginx.org/download/nginx-0.8.54.tar.gz') sudo('cd /opt; tar -zxvf nginx*') sudo('cd /opt/nginx*/; ./configure --prefix=/opt/nginx --user=nginx --group=nginx --with-http_ssl_module') sudo('cd /opt/nginx*/; make') sudo('cd /opt/nginx*/; make install') sudo('adduser --system --no-create-home --disabled-login --disabled-password --group nginx') sudo('cp /opt/uwsgi*/nginx/uwsgi_params /opt/nginx/conf/uwsgi_params') put('init-nginx', '/etc/init.d/nginx') sudo('chmod +x /etc/init.d/nginx') sudo('/usr/sbin/update-rc.d -f nginx defaults') sudo('/etc/init.d/nginx start') put('init-uwsgi', '/etc/init.d/uwsgi') sudo('chmod +x /etc/init.d/uwsgi') sudo("""echo 'PYTHONPATH=/var/web2py/ MODULE=wsgihandler' >> /etc/default/uwsgi""") sudo('/usr/sbin/update-rc.d -f uwsgi defaults') sudo('/etc/init.d/uwsgi start') sudo('rm /opt/nginx/conf/nginx.conf') put('nginx.conf', '/opt/nginx/conf/nginx.conf') sudo('cd /opt/nginx/conf; openssl genrsa -out server.key 1024') sudo('cd /opt/nginx/conf; openssl req -batch -new -key server.key -out server.csr') sudo('cd /opt/nginx/conf; openssl x509 -req -days 1780 -in server.csr -signkey server.key -out server.crt') sudo('/etc/init.d/nginx restart') === nginx.conf === user www-data; worker_processes 4; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; keepalive_timeout 2; sendfile on; #tcp_nopush on; tcp_nodelay on; gzip on; # HTTP server server { listen 80; server_name ""; location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; } location /static { root /var/web2py/applications/init/; } } # HTTPS server server { listen 443; server_name ""; ssl on; ssl_certificate /opt/nginx/conf/server.crt; ssl_certificate_key /opt/nginx/conf/server.key; location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; } } }