server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # SPA history fallback — react-router uses client-side routes. location / { try_files $uri $uri/ /index.html; } # Cache hashed Vite assets aggressively. location /assets/ { access_log off; add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } }