server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; gzip on; gzip_types text/plain text/css application/javascript application/json image/svg+xml; gzip_min_length 1024; gzip_vary on; # SPA fallback — all routes resolve to index.html location / { try_files $uri $uri/ /index.html; } # Immutable cache for hashed assets (Vite adds content hashes) location ~* \.(js|css|woff2?)$ { expires 1y; add_header Cache-Control "public, immutable"; } location ~* \.(png|jpg|jpeg|gif|svg|ico|webp)$ { expires 30d; add_header Cache-Control "public"; } }