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