Revert "fix: update nginx for Astro SSG — /_astro/ cache, remove SPA fallback"

This reverts commit 918e45f9da.
This commit is contained in:
asepharyana
2026-07-02 03:54:44 +07:00
parent 5a10bec67a
commit 91e14abbda
+5 -6
View File
@@ -1,4 +1,4 @@
# Nginx config for serving Astro-built static frontend files # Nginx config for serving Vite-built static frontend files
server { server {
listen 3000; listen 3000;
server_name _; server_name _;
@@ -11,15 +11,14 @@ server {
gzip_types text/plain text/css application/json application/javascript image/svg+xml; gzip_types text/plain text/css application/json application/javascript image/svg+xml;
gzip_min_length 256; gzip_min_length 256;
# Cache Astro hashed assets (/_astro/) — immutable since hash changes # Cache static assets (JS/CSS hashed filenames)
location /_astro/ { location /assets/ {
expires 1y; expires 1y;
add_header Cache-Control "public, immutable"; add_header Cache-Control "public, immutable";
} }
# Astro SSG pages — each route is a real directory with index.html # SPA fallback — all non-file routes serve index.html
# Fallback to 404 instead of index.html (no SPA catch-all)
location / { location / {
try_files $uri $uri/ =404; try_files $uri $uri/ /index.html;
} }
} }