当前位置:首页 > 服务器技术 > nginx

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

 


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!