server { listen 80; # The location of our static files root /usr/share/nginx/html; index index.html; location / { # Try to serve the file directly, then as a directory, and finally fall back to index.html for SPA routing try_files $uri $uri/ /index.html; } # Add caching headers for static assets to improve performance location ~* \.(?:ico|css|js|gif|jpe?g|png|webp|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } }