diff --git a/compose.yaml b/compose.yaml index b7ed84e..918e54d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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 diff --git a/nginx.conf b/nginx.conf index 66ee6c3..0e7ea01 100644 --- a/nginx.conf +++ b/nginx.conf @@ -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/; - } } }