vue-router在nginx的配置


vue.config.js

module.exports = {
  publicPath: "/vue3/", # 项目url
  outputDir: "vue3",    # 项目打包名
  assetsDir: "static",  # 静态文件夹名
};

nginx

location /vue3/ {
    root html; # 把打包完的文件夹放nginx的html文件夹里
    index index.html;
    try_files $uri $uri/ /vue3/index.html;
}

相关