1.router.js添加base
const router = new Router({
mode: 'history', // history、hash 路由模式
base: '/blockchain/',
routes
});
// 打包输出的公共路径 publicPath 的值需要和 router.js 中base的值一致
module.exports = {
outputDir: 'dist', // 打包输出文件夹
publicPath: process.env.NODE_ENV === 'production' ? '/blockchain/' : '/',
}
3.服务器 nginx.conf 文件配置
// server 的配置
server {
listen 80;
server_name test.com;
#charset oi8-r;
#access_log logs/host.access.log main;
# 根目录访问, http://test.com/
location / {
root /root/provenance/front/react;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
# 二级目录访问, http://test.com/blockchain
location /blockchain {
alias /root/provenance_blockchain/;
try_files $uri $uri/ /blockchain/index.html;
index index.html index.htm;
}
}
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- oldu.cn 版权所有 浙ICP备2024123271号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务