vue项目nginx部署二级目录

436 阅读1分钟

一、修改router.js中添加base根目录配置

const vueRouter = new Router({
    mode: 'history',
    base: 'app',

二、修改vue.config.js中添加publicPath

module.exports = {
  publicPath: '/app/',

三、修改nginx.conf中的配置,设置二级目录

	location ^~/app {
		alias /usr/local/app;
		try_files $uri $uri/ /app/index.html;
	}