Skip to content

Instantly share code, notes, and snippets.

@dequn

dequn/nginx.conf

Forked from lciolecki/nginx.conf
Created Aug 17, 2018
Embed
What would you like to do?
Nginx config for django rest framework + angular application
server {
listen 80;
listen 443 ssl;
server_name your-domain.com;
charset utf-8;
client_max_body_size 32M;
root /project/static;
index index.html;
error_page 404 /404.html;
error_page 502 /service-unavailable.html;
error_page 503 /service-unavailable.html;
location ~^/((?!static|media).)*\.(gif|jpg|jpeg|png|js|css|woff|woff2|eot|svg|ttf)$ {
gzip_static on;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
}
location /media {
alias /project-RW/media;
gzip_static on;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
access_log off;
}
location /static {
alias /project/static;
gzip_static on;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
access_log off;
}
location ~^/(django-admin|api|ckeditor) {
include uwsgi_params;
uwsgi_pass django-project;
uwsgi_read_timeout 300;
proxy_set_header X-Forwarded-Protocol $scheme;
}
location / {
expires -1;
add_header Pragma "no-cache";
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
try_files $uri $uri/ /index.html =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.