diff --git a/base/nginx.conf b/base/nginx.conf index 1bc528d..c8d22f6 100644 --- a/base/nginx.conf +++ b/base/nginx.conf @@ -18,10 +18,10 @@ http { listen 8081; server_name localhost; - # 前端静态资源目录 location / { - root /usr/share/nginx/html; - index index.html index.htm; + root /usr/share/nginx/html; # 前端静态文件目录 + try_files $uri $uri/ /index.html; # 将未找到的文件重定向到 index.html + index index.html index.htm; } # 转发 API 请求到后端服务