Skip to content

Instantly share code, notes, and snippets.

@martijnarts
Created April 29, 2013 01:33
Show Gist options
  • Save martijnarts/5479220 to your computer and use it in GitHub Desktop.
Save martijnarts/5479220 to your computer and use it in GitHub Desktop.
nginx, Supervisor, uWSGI and Flask: config samples for nginx and Supervisor.
; Change {domain} to your domain name (or whatever you want to call the program)
; Change {modulename} to the Python module where you create your Flask app (for example, run if your file is called run.py)
; Change {website_root} to the directory wherever this module is located (/home/user/website/, for example)
[program:{domain}]
command=/usr/bin/uwsgi
--socket=/home/uwsgi/{domain}.sock
--pythonpath=/
--touch-reload=/app.wsgi
--chmod-socket=664
--uid=uwsgi
--gid=uwsgi
--processes 1
--master
--no-orphans
--max-requests=5000
--module={modulename}
--callable=app
user=uwsgi
directory={website_root}
stdout_logfile=/home/uwsgi/{domain}.log
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
# nginx vhosts.conf entry example:
# Change {domain} to your domain name (or whatever you want to call the program)
# Change {app_name} to the name of your app (or really whatever you want)
# {domain}
server {
listen 80;
server_name {domain};
location / { try_files $uri @{app_name}; }
location @{app_name} {
include uwsgi_params;
uwsgi_pass unix:/home/uwsgi/{domain}.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment