Files
one-pipe-system/docker/nginx.conf
huang fd583e81e0
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 2m22s
fix: 修复部署后切换页面 JS chunk 404 白屏问题
- main.ts 监听 vite:preloadError,chunk 加载失败时自动刷新一次
- 新增 ChunkErrorBoundary 组件,捕获 Vue 渲染层 chunk 加载异常
- App.vue 包裹 ChunkErrorBoundary
- docker/nginx.conf 修复缓存策略:index.html 不缓存,/assets/ 长缓存 immutable
2026-04-18 12:24:18 +08:00

38 lines
883 B
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/json application/xml;
gzip_comp_level 6;
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
location /health {
access_log off;
return 200 'OK';
add_header Content-Type text/plain;
}
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
access_log off;
}
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /index.html;
}