diff --git a/nginx.conf b/nginx.conf index 594a4161a..4894c6d73 100644 --- a/nginx.conf +++ b/nginx.conf @@ -144,6 +144,16 @@ server { try_files /index.html =404; } + # /welcome 是 React 路由,同时也是欢迎页静态素材目录;精确命中路由时优先回退到 SPA, + # 避免 Nginx 把目录当作文件列表并返回 403,或生成带容器端口的 301。 + location = /welcome { + try_files /index.html =404; + } + + location = /welcome/ { + try_files /index.html =404; + } + location / { try_files $uri $uri/ /index.html; }