This example use:

1supervisord process runner/restarter

2gunicornPython WSGI HTTP Server that will run Django application and listen for requests on some ports

3nginx a proxy that will filter requests by domain names and proxy them to the destination port on which gunicorn listens. Also, it serves static for us without involving Django

in /etc/supervisor/conf.d/app.conf:

command=/envs/your_env/bin/gunicorn your_app.wsgi:application -b localhost:8005 -t 120
directory=/srv/your_app_dir/  # where your_app/ 
environment = PATH="/some/bin/path/if/you/want", OTHER_VAR="val"

sudo supervisorctl start your_supervisor_service

Example of nginx proxy to gunicorn (with https):


server {
    listen      80;
    return 301 https://$server_name$request_uri;

server {
    listen      443;
    client_max_body_size 20M;

    ssl on;
    ssl_certificate /etc/ssl/some.crt;
    ssl_certificate_key /etc/ssl/some.key;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://localhost:8005;

    location /static/ {
        alias     /srv/your_app/static/;

    location /media/ {
        alias    /srv/your_app/media/;