Last active
November 3, 2019 06:21
-
-
Save hiendnguyen/bccf6aa9e4e6fe2cb013ddfee39ce91b to your computer and use it in GitHub Desktop.
NGINX config for uWSGI and Django
This file contains hidden or 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
vi /etc/nginx/conf.d/django.conf | |
# Put below content in it. | |
# the upstream component NGINX needs to connect to | |
upstream django { | |
server unix:/run/uwsgi/django.sock; | |
} | |
# configuration of the server | |
server { | |
listen 80; | |
server_name example.com; | |
charset utf-8; | |
# max upload size | |
client_max_body_size 75M; | |
# Django media & static | |
location /media { | |
alias /var/www/example/django/public/media; | |
} | |
location /static { | |
alias /var/www/example/django/public/static; | |
} | |
# Finally, send all non-media requests to the Django server. | |
location / { | |
uwsgi_pass django; | |
include uwsgi_params; | |
uwsgi_param Host $host; | |
uwsgi_param X-Real-IP $remote_addr; | |
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for; | |
uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment