vue项目nginx部署二级目录

一、修改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;
	}

posted @ 2022-04-29 11:14  天天代码码天天  阅读(148)  评论(0)    收藏  举报  来源