feat(deploy): 挂载 web/public 与 web/promotion 到 yh_web,支持热更新无需重建 dist

Made-with: Cursor
This commit is contained in:
whm
2026-03-22 00:58:19 +08:00
parent 122f5b8fba
commit 66b873d0b0
4 changed files with 28 additions and 3 deletions

View File

@@ -17,7 +17,18 @@ server {
add_header Cache-Control "public, immutable";
}
# web/public 挂载到 /var/www/yh-public与 dist 根目录同 URL如 /logo.png优先读挂载无则回退 dist
location ~ ^/([^/]+\.(?:png|jpe?g|gif|ico|svg|webp|webmanifest))$ {
root /var/www/yh-public;
try_files /$1 @dist_root_public;
}
location @dist_root_public {
root /usr/share/nginx/html;
try_files $uri =404;
}
# 推广素材:文件必须真实存在,禁止落到 SPA index.html否则前端误判「静态存在」、视频拿到 HTML
# 宿主机 ./web/promotion 挂载覆盖本路径,改 social 下文件无需重新 npm build
location ^~ /promotion/ {
try_files $uri =404;
add_header Cache-Control "public, max-age=86400";