Created
December 29, 2012 10:48
-
-
Save widoyo/4406049 to your computer and use it in GitHub Desktop.
Deploy Django nGinx uwsgi di Webfaction
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
Deploy Django-Nginx-uwsgi pada web faction | |
referensi: http://community.webfaction.com/questions/10242/installing-nginx-uwsgi | |
APPNAME="tracker" | |
/home/narayana/webapps/tracker | |
bin | |
start | |
stop | |
restart | |
nginx | |
conf | |
nginx.conf | |
html | |
static | |
css dst | |
fews_track | |
fews | |
settings.py | |
local_settings.py | |
wsgi.py |
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
#user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
access_log /home/narayana/logs/user/access_tracker.log combined; | |
error_log /home/narayana/logs/user/error_tracker.log crit; | |
sendfile on; | |
#tcp_nopush on; | |
#keepalive_timeout 0; | |
keepalive_timeout 65; | |
#gzip on; | |
server { | |
listen 127.0.0.1:14745; | |
#charset koi8-r; | |
#access_log logs/host.access.log main; | |
location / { | |
include uwsgi_params; | |
uwsgi_pass unix:///home/narayana/webapps/tracker/uwsgi.sock; | |
} | |
#error_page 404 /404.html; | |
# redirect server error pages to the static page /50x.html | |
# | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
location /static { | |
autoindex on; | |
alias /home/narayana/webapps/tracker/nginx/html/static/; | |
} | |
} |
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
#!/bin/bash | |
APPNAME="tracker" | |
${HOME}/webapps/${APPNAME}/bin/stop | |
sleep 5 | |
${HOME}/webapps/${APPNAME}/bin/start |
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
#!/bin/bash | |
APPNAME="tracker" | |
# start uwsgi | |
${HOME}/webapps/${APPNAME}/bin/uwsgi \ | |
--uwsgi-socket "${HOME}/webapps/${APPNAME}/uwsgi.sock" \ | |
--master \ | |
--workers 1 \ | |
--max-requests 10000 \ | |
--harakiri 60 \ | |
--daemonize ${HOME}/webapps/${APPNAME}/uwsgi.log \ | |
--pidfile ${HOME}/webapps/${APPNAME}/uwsgi.pid \ | |
--vacuum \ | |
--python-path ${HOME}/webapps/${APPNAME}/fews_track \ | |
--wsgi wsgi | |
# start nginx | |
${HOME}/webapps/${APPNAME}/bin/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
#!/bin/bash | |
APPNAME="tracker" | |
# stop uwsgi | |
${HOME}/webapps/${APPNAME}/bin/uwsgi --stop ${HOME}/webapps/${APPNAME}/uwsgi.pid | |
# stop nginx | |
kill $(cat ${HOME}/webapps/${APPNAME}/nginx/logs/nginx.pid) |
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 sys | |
import os | |
sys.path = [ | |
'/home/narayana/.virtualenvs/django_fb/lib/python2.7/site-packages', | |
'/home/narayana/webapps/tracker/fews_track', | |
] + sys.path | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'fews.settings' | |
import django.core.handlers.wsgi | |
application = django.core.handlers.wsgi.WSGIHandler() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment