如何使用nginx解决跨域问题(适用于一般项目,不适用于vue)

1.下载nginx

-参考https://blog.csdn.net/qq947289507/article/details/81305019大鱼博客

2.点击nginx.exe运行

3.在浏览器中 输入localhost:80 看是否能运行--如果80被占,则需要 nginx-1.14.2\conf的文件按nginx.conf文件修改一下

4.把需要运行的文件放在html文件夹下

5.在浏览器中输入 localhost:80/文件目录 -----------------------------------------------

6.修改 nginx-1.14.2\conf的文件

按nginx.conf里面的 43行

location / { root html; index index.html index.htm; }

替换为

location / { root html; index index.html index.htm;    proxy_pass http://zzfyxcx.com:5010; }

猜你喜欢

转载自blog.csdn.net/weixin_44169288/article/details/88049035