diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..d1bd91d --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:1.29 + +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..c12abb0 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,30 @@ +server { + listen 8000; + server_name _; + + # Max upload size + client_max_body_size 75M; + + # Serve static files + location /static/ { + alias /app/static/; + expires 30d; + add_header Cache-Control "public, max-age=2592000"; + } + + # Serve media files + location /media/ { + alias /app/media/; + expires 30d; + add_header Cache-Control "public, max-age=2592000"; + } + + # Proxy pass all other requests to Gunicorn (or uWSGI) + location / { + proxy_pass http://web:8001; # Gunicorn/WSGI server address + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} \ No newline at end of file