server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Cache long pour les assets (JS, CSS, images, fonts) location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } # SPA fallback — Astro génère du statique, mais au cas où location / { try_files $uri $uri/ /index.html; } # Pas de log pour favicon/robots location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } # Compression gzip gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml; gzip_min_length 256; }