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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM