server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Ensure proper MIME types for JavaScript, CSS, etc. include /etc/nginx/mime.types; # Serve static assets directly location /assets/ { root /usr/share/nginx/html; try_files $uri =404; expires 30d; add_header Cache-Control "public, no-transform"; } # SPA routing fallback for app routes location / { try_files $uri $uri/ /index.html; } }