server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # gzip everything gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss image/svg+xml; # long cache for fingerprinted assets location ~* \.(woff2|css|js|svg|png|jpg|jpeg|webp|avif|ico)$ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # sitemap / rss location = /sitemap.xml { rewrite ^ /sitemap-index.xml redirect; } location ~* ^/(rss\.xml|sitemap.*\.xml|robots\.txt)$ { add_header Cache-Control "public, max-age=300"; try_files $uri =404; } # Astro static fallback to .html location / { try_files $uri $uri/ $uri.html $uri/index.html /index.html; } # /admin goes to the CMS upstream location /admin { return 301 https://cms.softvowels.example$request_uri; } error_page 404 /index.html; }