Skip to content

Instantly share code, notes, and snippets.

@kuno
Forked from timmyomahony/nginx.conf
Created February 7, 2012 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuno/1760356 to your computer and use it in GitHub Desktop.
Save kuno/1760356 to your computer and use it in GitHub Desktop.
Python, UWSGI, Supervisor & Nginx
upstream uwsgi {
ip_hash;
server 127.0.0.1:40000;
}
server {
listen 80;
server_name www.domain.com;
root /sites/mysite/;
access_log /sites/mysite/log/nginx/access.log;
error_log /sites/mysite/log/nginx/error.log;
location /media/ {
alias /sites/mysite/media/;
}
location /static/ {
alias /sites/mysite/static/;
}
location / {
include uwsgi_params;
uwsgi_pass uwsgi;
uwsgi_param UWSGI_PYHOME $document_root;
uwsgi_param UWSGI_CHDIR $document_root/project_root;
uwsgi_param UWSGI_SCRIPT confs.django_wsgi;
}
}
[program:uwsgi]
user = uwsgi
command=/opt/bin/uwsgi --xmlconfig=/sites/mywebsite/myproject/confs/uwsgi.xml
autostart=true
autorestart=true
stderr_logfile = /sites/mywebsite/log/uwsgi/err.log
stdout_logfile = /sites/mywebsite/log/uwsgi/out.log
stopsignal=INT
<uwsgi>
<socket>127.0.0.1:40000</socket>
<processes>2</processes>
<master/>
<post-buffering>4096</post-buffering>
<harakiri>20</harakiri>
</uwsgi>
import os,sys
import django.core.handlers.wsgi
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.production'
application = django.core.handlers.wsgi.WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment