server {
server_name .example.com;
root /srv/example.com/htdocs;
}
> sudo apt-get install php5-fpm
server {
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
> sudo apt-get install fcgiwrap
server {
location /cgi-bin/ {
root /srv/example.com/cgi-bin;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
> sudo apt-get install uwsgi-plugin-python
server {
location / {
uwsgi_pass 127.0.0.1:3031;
include uwsgi_params;
}
}
Configuration file example (uwsgi.ini) for uWSGI:
[uwsgi]
socket = 127.0.0.1:3031
master = true
processes = 2
env = DJANGO_SETTINGS_MODULE=djangoapp.settings
module = django.core.handlers.wsgi:WSGIHandler()
home = /path/to/virtualenv
touch-reload = /path/to/reload