Skip to content

Instantly share code, notes, and snippets.

@teisman
Last active December 12, 2015 02:48
Show Gist options
  • Save teisman/4701091 to your computer and use it in GitHub Desktop.
Save teisman/4701091 to your computer and use it in GitHub Desktop.

Settings by Maxime

##Installation

$ sudo apt-get install nginx supervisor
$ pip install uwsgi

##uWSGI Configure an uWSGI app in /etc/uwsgi.ini:

[uwsgi]
socket = 127.0.0.1:3031
chdir = /path/to/my/app
module = example:app
env = EXAMPLE_ENV=prod

##Nginx Add a server entry in Nginx in /etc/nginx/sites-enabled/example.conf:

server {
    listen 80;
    server_name example.com;
    root /path/to/my/app/example/static;

    location / {
        try_files $uri @uwsgi;
    }

    location @uwsgi {
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:3031;
    }
}

##Supervisor

Finally, configure Supervisor to manage the uWSGI process in /etc/supervisor/conf.d/example.conf:

[program:example]
command=/usr/local/bin/uwsgi --ini /etc/uwsgi.ini
autostart=true
autorestart=true
stopsignal=INT

##Restart

$ sudo /etc/init.d/nginx restart
$ sudo /etc/init.d/supervisor reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment