fix:提交更新

This commit is contained in:
ljy
2026-08-26 00:44:25 +08:00
parent 83c52614be
commit b822d21eae
20 changed files with 1491 additions and 72 deletions
+37
View File
@@ -0,0 +1,37 @@
# Nginx / 宝塔:分层缓存片段(并入 server {} 后 reload)
# Vite 构建产物在 /assets/ 下且文件名含 content hash → 长缓存
# 注意:若 public 静态图也挂在 /assets/,与构建产物同前缀时用扩展名区分
location = /index.html {
add_header Cache-Control "public, max-age=0, must-revalidate";
}
location ~* \.html$ {
add_header Cache-Control "public, max-age=0, must-revalidate";
}
# Vite 打出的带 hash 的 JS/CSS(部署后路径通常为 /assets/index-xxxxx.js)
location ~* ^/assets/.*\.(?:js|css)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# 同域兜底图片(生产主图应走 OSS;若仍有本地图则 7 天)
location ~* ^/assets/.*\.(?:png|jpe?g|gif|webp|svg|ico)$ {
add_header Cache-Control "public, max-age=604800";
try_files $uri =404;
}
location = /robots.txt {
add_header Cache-Control "public, max-age=0, must-revalidate";
}
location = /sitemap.xml {
add_header Cache-Control "public, max-age=0, must-revalidate";
default_type application/xml;
}
# SPA 路由回退(按实际根目录调整)
# location / {
# try_files $uri $uri/ /index.html;
# }