因为域名有限,所以想把vue项目部署在某个域名的二级路径上,例如:https://www.example.com/someapp/下 nginx的配置如下: location ^~ /someapp/ { index index.html; alias /opt/someapp/; try_files $uri $uri/ /someapp/index.html; } 在/opt/下新建someapp目录,里面放的就是vue项目打包后的html文件 修改路由文件:router/index.js,主要是history…