-
-
Save rpherrera/3fb3d5c47d7475c51171 to your computer and use it in GitHub Desktop.
Python, UWSGI, Supervisor & Nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream uwsgi { | |
ip_hash; | |
server 127.0.0.1:40000; | |
} | |
server { | |
listen 80; | |
server_name www.domain.com; | |
root /sites/mysite/; | |
access_log /sites/mysite/log/nginx/access.log; | |
error_log /sites/mysite/log/nginx/error.log; | |
location /media/ { | |
alias /sites/mysite/media/; | |
} | |
location /static/ { | |
alias /sites/mysite/static/; | |
} | |
location / { | |
include uwsgi_params; | |
uwsgi_pass uwsgi; | |
uwsgi_param UWSGI_PYHOME $document_root; | |
uwsgi_param UWSGI_CHDIR $document_root/project_root; | |
uwsgi_param UWSGI_SCRIPT confs.django_wsgi; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:uwsgi] | |
user = uwsgi | |
command=/opt/bin/uwsgi --xmlconfig=/sites/mywebsite/myproject/confs/uwsgi.xml | |
autostart=true | |
autorestart=true | |
stderr_logfile = /sites/mywebsite/log/uwsgi/err.log | |
stdout_logfile = /sites/mywebsite/log/uwsgi/out.log | |
stopsignal=INT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uwsgi> | |
<socket>127.0.0.1:40000</socket> | |
<processes>2</processes> | |
<master/> | |
<post-buffering>4096</post-buffering> | |
<harakiri>20</harakiri> | |
</uwsgi> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os,sys | |
import django.core.handlers.wsgi | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.production' | |
application = django.core.handlers.wsgi.WSGIHandler() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment