vue 子目录配置,负载均衡 nginx

1. 我使用的是,腾讯云做负载均衡。

  负载均衡配置: https://www.xxxx.com/vue   域名指向的服务器地址:10.10.10.10:80/vue

2. nginx 配置:

server {
        listen       80;
        location /vue{
        #root 最后指向的地址是: /home/h5/vue/静态文件 root
/home/h5; index index.html index.htm; try_files $uri $uri/ /vue/index.html; } }

3. vue 配置

我是用的是 vue-cli 3 , 

vue.config.js 文件配置

module.exports = {
       publicPath: '/vue/'  
}

路由配置,routers.js

mode: 'history',
base: '/vue',

ok

 

posted @ 2020-03-26 12:55  Easn°  阅读(825)  评论(0编辑  收藏  举报