Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

前台用nginx作为服务器路由问题 #12

Open
Lang-Zh opened this issue Aug 11, 2019 · 4 comments
Open

前台用nginx作为服务器路由问题 #12

Lang-Zh opened this issue Aug 11, 2019 · 4 comments

Comments

@Lang-Zh
Copy link

Lang-Zh commented Aug 11, 2019

前台我使用webpack打包后使用用nginx作为服务器 ,好像因为前台不像后台使用的前端路由 ,只有首页有效 跳转其他页面都会有问题 请问要怎么处理

@llldddbbb
Copy link
Owner

因为我的路由是histroy模式,nginx需要配 try_files $uri $uri/ /index.html; 如下:

server {
listen 80;
server_name dblearn.cn www.dblearn.cn;
location / {
root /home/bobbi/deploy/dbblog/dbblog-frontend/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
}

@llldddbbb
Copy link
Owner

@Lang-Zh
Copy link
Author

Lang-Zh commented Aug 17, 2019

谢谢大佬 已解决

@ruiyeclub
Copy link

因为我的路由是histroy模式,nginx需要配 try_files $uri $uri/ /index.html; 如下:

server {
listen 80;
server_name dblearn.cn www.dblearn.cn;
location / {
root /home/bobbi/deploy/dbblog/dbblog-frontend/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
}

能看一下nginx完整的配置吗 nginx的配置搞不定

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants