add nginx

This commit is contained in:
TDLaouer 2025-07-13 19:26:32 +02:00
parent d6792cadd0
commit 6c8161985b
2 changed files with 34 additions and 0 deletions

4
nginx/Dockerfile Normal file
View File

@ -0,0 +1,4 @@
FROM nginx:1.29
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d

30
nginx/nginx.conf Normal file
View File

@ -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;
}
}