Update nginx

This commit is contained in:
Andros Fenollosa 2024-09-01 21:40:23 +02:00
parent 488bdfe3e2
commit 1178fba25d
2 changed files with 13 additions and 8 deletions

View File

@ -40,8 +40,8 @@ services:
ports: ports:
- 8000:80 - 8000:80
volumes: volumes:
- ./static:/var/www/static - ./static:/usr/share/nginx/html/static
- ./media:/var/www/media - ./media:/usr/share/nginx/html/media
- ./nginx.conf:/etc/nginx/nginx.conf - ./nginx.conf:/etc/nginx/nginx.conf
depends_on: depends_on:
- django - django

View File

@ -12,13 +12,18 @@ http {
location = /favicon.ico { access_log off; log_not_found off; } location = /favicon.ico { access_log off; log_not_found off; }
# Django location / {
location /static/ { proxy_pass http://django:8000;
alias /var/www/static/; proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
} }
location /media/ {
alias /var/www/media/;
}
} }
} }