Skip to content

Instantly share code, notes, and snippets.

@almet
Created August 3, 2011 15:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save almet/1122843 to your computer and use it in GitHub Desktop.
Save almet/1122843 to your computer and use it in GitHub Desktop.
Or how to deploy a django application using nginx + gunicorn + supervisord
backlog = 2048
daemon = False
debug = True
workers = 3
logfile = "/usr/local/www/lolnet.org/reader/reader.gunicorn.log"
loglevel = "info"
bind = "unix:/usr/local/www/lolnet.org/reader/reader.gunicorn.sock"
server {
server_name reader.lolnet.org;
keepalive_timeout 5;
location /static/ {
alias /usr/local/www/lolnet.org/reader/reader/media/;
}
location /media/ {
alias /usr/local/www/lolnet.org/reader/reader-venv/lib/python2.6/site-packages/django/contrib/admin/media/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_connect_timeout 90;
proxy_send_timeout 180;
proxy_read_timeout 180;
proxy_buffer_size 16k;
proxy_buffers 8 16k;
proxy_busy_buffers_size 32k;
proxy_intercept_errors on;
if (!-f $request_filename) {
proxy_pass http://django_backend;
break;
}
}
}
upstream django_backend {
server unix:/usr/local/www/lolnet.org/reader/reader.gunicorn.sock;
}
# BASIC STUFF [...]
# CONF
[program:reader]
command=/usr/local/www/lolnet.org/reader/reader-venv/bin/gunicorn_django -c /usr/local/www/lolnet.org/reader/gunicorn.conf.py /usr/local/www/lolnet.org/reader/reader/settings.py
directory=/usr/local/www/lolnet.org/reader/reader
user=www
autostart=true
autorestart=true
redirect_stderr=True
@arnaudbos
Copy link

Hum, maybe I'll be the only one around not understanding what this is for, but just in case I suggest you add a short description :)

@almet
Copy link
Author

almet commented Aug 3, 2011

Oh, ppl are reading, awesome.

@arnaudbos
Copy link

Heh, you've made it public man! What did you expect? :D
Checkout mine if you wanna ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment