vue2 前后端分离的项目,用宝塔部署,出现域名访问根目录能访问,加任何网址就404

https://admin.xxx.com/  访问正常

https://admin.xxx.com/index   访问404


location / {
            root   /home/ruoyi/projects/ruoyi-ui;
            try_files $uri $uri/ /index.html;
            index  index.html index.htm;
        }

 

nginx 加上上面这段即可,表示不管哪个目录,都会访问根目录的index.html文件
posted @ 2023-11-16 17:24  蓝西0320  阅读(100)  评论(0编辑  收藏  举报