server { listen 80; server_name _; # Allow multi-GB movie uploads client_max_body_size 20g; # Long timeouts for streaming + transcode responses proxy_read_timeout 3600s; proxy_send_timeout 3600s; proxy_connect_timeout 60s; # gzip static gzip on; gzip_types text/plain text/css application/javascript application/json image/svg+xml; # Reverse proxy /api → backend service on the compose network location /api/ { proxy_pass http://backend:8001; proxy_http_version 1.1; 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_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Streaming needs unbuffered responses for Range requests proxy_buffering off; proxy_request_buffering off; } # SPA static files with client-side routing fallback location / { root /usr/share/nginx/html; try_files $uri /index.html; } # Cache static assets aggressively (hashed filenames from CRA) location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { root /usr/share/nginx/html; expires 30d; add_header Cache-Control "public, immutable"; } }