在 ” 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的解决方案

https://router.vuejs.org/zh-cn/essentials/history-mode.html

相关文章:

  • 2021-06-23
  • 2021-09-01
  • 2021-11-28
  • 2022-01-07
  • 2021-07-16
  • 2022-12-23
  • 2022-03-01
猜你喜欢
  • 2021-07-17
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-06-14
  • 2021-07-17
相关资源
相似解决方案