server { listen 80; root /usr/share/nginx/html; index index.html; # Static build assets. Must exist — if missing, return 404 instead of # falling through to index.html (which would confuse the browser with a # "text/html MIME for JS module" error). location /assets/ { try_files $uri =404; expires 1y; access_log off; add_header Cache-Control "public, immutable"; } # SPA routing: serve index.html for any client-side route. location / { try_files $uri $uri/ /index.html; } }