vue路由配置
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
mode: 'history',
base: process.env.NODE_ENV === 'production' ? '/project/' : '/',
routes: []
})
vue.config.js配置不同环境打包地址
const env = process.env.NODE_ENV
const publicPath = env === 'production'
? '/project/'
: '/';
module.exports = {
publicPath: publicPath,
}
nginx 服务器配置 二级目录配置
在nginx.conf文件中配置
location /project {
root /home;
index index.html;
try_files $uri $uri/ /project/index.html;
}
在/usr/local/nginx/sbin 目录下执行命令nginx -s reload 重启nginx服务