Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NGINX config for uWSGI and Django
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;
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