解决 Nginx 部署 Vue 项目路由出现 404 的问题
程序开发
2023-09-11 17:37:38
1、下载nginx,将打包好的vue项目文件放到 nginx-1.20.2html 文件夹里面
2、在 nginx-1.20.2conf 文件夹下,修改 nginx.conf 文件的内容,也就是部署入口路由
nginx.conf :
server {listen 80; // 设置运行端口server_name example.com;location / {root /home/example/dist;try_files $uri $uri/ @router; # 配置使用路由index index.html index.htm; }# 路由配置信息 解决路由跳转失败location @router {rewrite ^.*$ /index.html last; }
}
标签:
相关文章
-
无相关信息