Files

38 lines
1.5 KiB
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Allow uploads up to 60 MB (backend limit is 50 MB by default,
# configured via MAX_UPLOAD_SIZE_MB; headroom for multipart overhead).
# nginx default is 1 MB, which causes 413 errors on large uploads.
client_max_body_size 60M;
# ── API proxy ─────────────────────────────────────────────────
# Container runtime (Docker/Podman) resolves backend:8000 via
# its built-in DNS (127.0.0.11). Without a resolver, nginx caches
# the resolved IP at startup and returns 502 when the backend
# container is recreated. The resolver + valid=5s forces periodic
# re-resolution so the frontend survives backend restarts.
resolver 127.0.0.11 valid=5s;
location /api/ {
proxy_pass http://backend:8000;
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;
proxy_connect_timeout 30s;
proxy_read_timeout 400s;
proxy_send_timeout 400s;
}
# ── Static files ──────────────────────────────────────────────
location / {
try_files $uri $uri/ /index.html;
expires 1y;
add_header Cache-Control "public, immutable";
}
}