fix(nginx): 验证文件改用 root+try_files,443 层挂载 verify-root 直连避免 403
Made-with: Cursor
This commit is contained in:
@@ -4,9 +4,12 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# 根路径下的验证文件走热加载目录
|
||||
location ~ ^/([A-Za-z0-9._-]+\.(txt|html|xml))$ {
|
||||
alias /verify-root/$1;
|
||||
# 域名/微信等验证文件:用 root+URI,勿用「正则 + alias $1」(易 403);文件放宿主机 ./verify-root/
|
||||
location ~ ^/[A-Za-z0-9._-]+\.(txt|html|xml)$ {
|
||||
root /verify-root;
|
||||
try_files $uri =404;
|
||||
default_type text/plain;
|
||||
add_header Cache-Control "no-store";
|
||||
}
|
||||
|
||||
# 静态资源必须真实存在,避免错误回退成 index.html 导致白屏
|
||||
|
||||
Reference in New Issue
Block a user