server { listen 3000; root /usr/share/nginx/html; index index.html; # SPA fallback: rimanda tutto a index.html location / { try_files $uri $uri/ /index.html; } # Cache aggressiva per assets (hash nel nome del file) location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, no-transform"; } # Nessuna cache per index.html location = /index.html { add_header Cache-Control "no-cache, no-store, must-revalidate"; } gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml; gzip_min_length 1000; }