# BuildFlow Web (web-antdv-next) Nginx 运行配置 # 仅 server 块,作为 conf.d/default.conf 覆盖 nginx 默认站点 # - SPA history 路由回退 index.html # - /api 反代到后端(生产由部署侧决定是否启用) # - 静态资源长缓存 server { listen 80; listen [::]:80; server_name _; root /usr/share/nginx/html; index index.html; gzip on; gzip_vary on; gzip_min_length 1024; gzip_comp_level 6; gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml application/rss+xml image/svg+xml font/woff font/woff2; # SPA history fallback location / { try_files $uri $uri/ /index.html; } # Vite 产物带 hash 文件名,可安全 immutable 长缓存 location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # 安全响应头 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; }