feat(deploy): 挂载 web/public 与 web/promotion 到 yh_web,支持热更新无需重建 dist
Made-with: Cursor
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user