server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; # Gzip compression gzip on; gzip_vary on; gzip_comp_level 6; gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml; # VitePress SPA routing location / { try_files $uri $uri.html $uri/ /index.html; } # Static assets caching location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # Health check endpoint location /health { return 200 'OK'; add_header Content-Type text/plain; } error_page 404 /404.html; }