Skip to content

Commit e725c90

Browse files
author
142vip.cn
committed
fix(nginx): 修改nginx配置,修复404页面出现首页问题
1 parent 9662072 commit e725c90

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nginx.conf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ http {
2626
# root 根目录,默认nginx镜像的html文件夹,可以指定其他
2727
root /usr/share/nginx/html;
2828
index index.html index.htm;
29-
# 如果vue-router使用的是history模式,需要设置这个
30-
try_files $uri $uri/ /index.html;
29+
30+
# # 确保能够处理前端路由,并在找不到对应文件或目录时返回 index.html 文件,让前端应用接管路由处理。
31+
# # 这对于使用前端框架(如 Vue.js、React、Angular 等)开发的单页应用非常有用
32+
# # 如果vue-router使用的是history模式,需要设置这个
33+
# try_files $uri $uri/ /index.html;
3134
}
3235
## 错误页面
3336
error_page 404 /404.html;

0 commit comments

Comments
 (0)