Skip to content

Instantly share code, notes, and snippets.

@astanway
Last active August 29, 2015 14:08
Show Gist options
  • Save astanway/b28868b315a598d75fc0 to your computer and use it in GitHub Desktop.
Save astanway/b28868b315a598d75fc0 to your computer and use it in GitHub Desktop.
basic python uwsgi nginx sock proxy
# nginx
server {
listen 80;
rewrite (.*) https://$http_host$1 permanent;
}
server {
listen 80 default_server;
location / {
include uwsgi_params;
add_header Access-Control-Allow-Origin *;
uwsgi_pass unix:/var/www/XXX.sock;
}
}
# supervisor
[program:uwsgi]
command=uwsgi -s /var/www/XXX.sock --file /var/www/XXX/webapp/webapp.py --callable app --processes 3 -t 60 -M --need-app --uid www-data --chown-socket www-data:www-data
directory=/var/www/XXX/webapp
process_name=%(program_name)s
numprocs=1
autostart=true
autorestart=true
stopsignal=TERM
stopwaitsecs=10
stdout_logfile=/var/log/uwsgi.log
redirect_stderr=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment