WebEnh

.net7 mvc jquery bootstrap json 学习中 第一次学PHP,正在研究中。自学进行时... ... 我的博客 https://enhweb.github.io/ 不错的皮肤:darkgreentrip,iMetro_HD
  首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

vue-cli3 项目路由 history 模式部署到 nginx 服务器

Posted on 2021-11-07 13:10  WebEnh  阅读(377)  评论(0编辑  收藏  举报

1.项目修改
vue.config.js增加

 publicPath: '/'

 


2.nginx配置

location / {#访问前端页面
root /data/dist;#vue项目存放路径
index index.html; #hash模式只配置访问html就可以了
try_files $uri $uri/ /index.html;#history模式配置否则会出现vue的路由在nginx中刷新出现404
}