问题

项目想要拥有多项目入口,且本地及网站均可通过直接加/admin 访问,而不是加 admin.html

vue.config.js 配置

module.exports = {
  // 路径前缀
  publicPath: './',
  lintOnSave: false,
  productionSourceMap: false,
  pages: {
    admin: {
      entry: 'src/main.js',
      filename: 'admin/index.html', // 指定生成的 admin 入口文件路径
    },
    reception: {
      entry: 'src/reception/main.js',
      filename: 'reception/index.html', // 指定生成的 reception 入口文件路径
    }
  },
}

nginx 配置

                location / {
                        #include ip_white.txt;
                        #deny all;
                        #root   /home/vue/dist;
                        #index  index.html index.htm;
                        rewrite ^/$ /reception permanent;
                }
                location /reception {
                        alias /home/vue/dist;
                        index reception/index.html;
                        #try_files $uri $uri/ /reception/index.html;
                }
                location /admin {
                        alias /home/vue/dist;
                        index admin/index.html;
                        #try_files $uri $uri/ /admin/index.html;
                        # return 404;
                }

Last Updated:
Contributors: haizhiguang