server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /usr/share/nginx/html; index index.html; # gzip gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css text/javascript text/xml application/javascript application/json application/xml application/xml+rss image/svg+xml font/ttf font/otf; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Cache static assets aggressively (Astro hashes filenames) location ~* \.(?:js|css|woff2?|ttf|otf|eot|svg|jpg|jpeg|png|webp|avif|ico)$ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # Don't cache HTML location ~* \.html$ { expires -1; add_header Cache-Control "no-cache, no-store, must-revalidate"; } # Thai URL slugs (Astro file-based routing produces paths with UTF-8 chars) location / { try_files $uri $uri/ $uri.html /index.html; } # healthcheck location /healthz { access_log off; return 200 "ok\n"; add_header Content-Type text/plain; } }