server { listen 80; server_name _; client_max_body_size 20m; root /usr/share/nginx/html; index index.html; # Proxy API calls to the FastAPI backend service location /api/ { proxy_pass http://api:8601; 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_read_timeout 120s; } # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { expires 1y; add_header Cache-Control "public, immutable"; } # SPA fallback — must come after API and assets location / { try_files $uri $uri/ /index.html; } }