原因:vue项目的路径时虚拟路径,并不存在,所以用nginx去请求请求不到,所以vue项目做了两部调整:

1、所有的请求后端接口地址前端写死

2、nginx里把所有的接口转发后端删掉,并添加以下内容 

        location / {
	   try_files $uri $uri/ @router;
            index index.html;
        }
	location @router {
            rewrite ^.*$ /index.html last;
        }

  

posted on 2021-12-15 20:26  程序员丁先生  阅读(324)  评论(0编辑  收藏  举报