| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- upstream django_project {
- server localhost:8000;
- }
- error_log /var/log/nginx/error.log;
- server {
- listen 8080;
- access_log /var/log/nginx/access.log;
- location / {
- proxy_pass http://django_project;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header Host $host;
- proxy_redirect off;
- client_max_body_size 100M;
- }
- location /static/ {
- alias /app/staticfiles/;
- }
- location /media/ {
- alias /app/mediafiles/;
- expires 1y;
- add_header Cache-Control "public, max-age=31536000, immutable";
- # Optimize for small files, combine small packets, and send directly
- tcp_nodelay on;
- tcp_nopush on;
- sendfile on;
- # Logging off for high-traffic image serving
- access_log off;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
- }
|