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:
- 8000:80
volumes:
- ./static:/var/www/static
- ./media:/var/www/media
- ./static:/usr/share/nginx/html/static
- ./media:/usr/share/nginx/html/media
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- django

View File

@ -12,13 +12,18 @@ http {
location = /favicon.ico { access_log off; log_not_found off; }
# Django
location /static/ {
alias /var/www/static/;
location / {
proxy_pass http://django:8000;
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/;
}
}
}