worker_processes auto; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; types { application/wasm wasm; } sendfile on; tcp_nopush on; gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/wasm; server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf|wasm)$ { expires 30d; add_header Cache-Control "public, immutable"; } # Proxy /api/ requests to the backend location /api/ { proxy_pass http://backend:3001; 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; } # SPA fallback — serve index.html for all other routes location / { try_files $uri $uri/ /index.html; } } }