1.前端修改部分,修改H5项目
1).在router/index.js 添加base: "/h5/"
const router = new VueRouter({
mode: 'history',
base: "/h5/",
routes
})
2).在vue.config.js添加如下代码
没有这个文件的话在根目录下创建
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "/h5" : "/",
}
2.配置nginx
1).在conf / ngin.conf 文件配置
server {
listen 80;
server_name localhost;
// 访问h5项目
location /h5/ {
root html;
try_files $uri $uri/ /h5/index.html;
index index.html;
}
// 访问web项目
location / {
root html/web;
try_files $uri $uri/ /index.html;
index index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
2).将项目打包放在html文件夹下面
直接放dist里面所有文件