vue-cli 部署到子目录

生产环境打包到子目录

module.exports = {
    // baseUrl: "",
    devServer: {
        host: "0.0.0.0",
        disableHostCheck: true
    },
          publicPath: process.env.NODE_ENV === 'production'
    ? '/dist/'
    : '/',
        outputDir: 'dist',
        assetsDir: 'static'
}

nginx 配置子目录路径

location /dist/ {
        try_files $uri $uri/ index.html  =404;
        error_page 404 /dist/;
}