在 ” etc/nginx/conf.d/ “路径下修改你的当前项目的conf文件
在location中添加,下文中加粗部分的代码,实现重写路径,以避免出现404。
location / {
root /root/www/dist;
index index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.html last;
break;
}
}
其他解决方案请参考
https://blog.csdn.net/u011025083/article/details/80352301
或者官方vue的解决方案