Skip to content

Instantly share code, notes, and snippets.

@centwave
Created June 16, 2013 00:09
Show Gist options
  • Save centwave/5790132 to your computer and use it in GitHub Desktop.
Save centwave/5790132 to your computer and use it in GitHub Desktop.
Nginx configuration for Django
server {
listen 80;
server_name server_name;
access_log /var/log/app/access.log;
error_log /var/log/app/error.log;
# https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-$
location /static { # STATIC_URL
alias /path/to/app/static; # STATIC_R$
}
location /media { # MEDIA_URL
alias /path/to/app/media; # MEDIA_ROOT
}
location ~* \.(?:icon|css|js|gif|jpe?g|png)$ {
expires 30d;
access_log off;
}
root /path/to/app/public;
location / {
include uwsgi_params;
uwsgi_param UWSGI_SCRIPT app;
uwsgi_pass 127.0.0.1:8080;
}
error_page 404 errors/404.html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment