Created
February 29, 2016 15:36
-
-
Save eliagbenu/749bc965b1f5500e2471 to your computer and use it in GitHub Desktop.
Sample configuration for Nginx with Django
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
#Sample nginx server block and uwsgi .ini configuration | |
#path to ini | |
/etc/uwsgi/apps-available/site.ini | |
#path to nginx server block | |
/etc/nginx/sites-available/site | |
#sample nginx config server blk | |
server { | |
# the port your site will be served on | |
listen 80; | |
# the domain name it will serve for | |
#Assuming serve name is example.com | |
server_name example.com; | |
charset utf-8; | |
access_log /var/log/nginx/site/access.log; | |
error_log /var/log/nginx/site/error.log; | |
# max upload size | |
client_max_body_size 75M; # adjust to taste | |
location /static { | |
alias /home/ubuntu/site_env/site/static; | |
} | |
location /static/admin { | |
alias /home/ubuntu/site_env/site/staticfiles/admin; | |
} | |
# Finally, send all non-media requests to the Django server. | |
location / { | |
uwsgi_pass unix:///sock/site.sock; | |
include /etc/nginx/uwsgi_params; | |
} | |
} | |
eg. uwsgi ini config | |
[uwsgi] | |
chdir=/home/ubuntu/site_env/site/ | |
wsgi-file=/home/ubuntu/site_env/site/msc/wsgi.py | |
virtualenv =/home/ubuntu/site_env/ | |
limit-as = 512 | |
master = true | |
pidfile=/home/ubuntu/site_env/master.pid | |
processes= 2 | |
socket=/sock/site.sock | |
vacuum = true | |
python-path =/home/ubuntu/site_env/ | |
binary-path = /usr/local/bin/uwsgi | |
chmod-socket=666 | |
daemonize=/home/ubuntu/site_env/daemonize.log | |
die-on-term = true | |
enable-threads = true | |
vacuum = true | |
vhost = true | |
workers = 1 | |
uid = www-data | |
gid = www-data | |
python-autoreload=1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment