用 NGINX 去反代理 IIS 服务器,访问 NGINX 服务器出现很多 502, 503 错误,有什么好的解决方法吗?

2020-04-11 12:00:43 +08:00
 imaning
测试直接访问源站 IIS 服务器,没有任何问题,访问正常,但是访问 NGINX 代理服务器,就会发现很多 502,503 错误,请问有什么好的方法解决么?
nginx 的缓存设置目前是这样的:

add_header X-Cache $upstream_cache_status;
#Set Nginx Cache

proxy_ignore_headers Set-Cookie Cache-Control expires;
proxy_cache cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 304 301 302 2m;
expires 12h;
1195 次点击
所在节点    问与答
3 条回复
KasuganoSoras
2020-04-11 17:13:20 +08:00
把 Nginx 的报错发上来看看才知道是什么原因造成的 502 啊……
imaning
2020-04-12 08:41:45 +08:00
@KasuganoSoras 看了下 nginx 的错误日志,全部都是这个(我隐去了 IP 地址):

2020/04/12 08:34:32 [error] 26838#0: *1721 connect() failed (111: Connection refused) while connecting to upstream, client: 171.209.*.*, server: test.com, request: "GET /Content/ HTTP/1.1", upstream: "http://180.149.*.*:80/hls/(158665164)/segment.ts", host: "61.139.*.*"
2020/04/12 08:34:32 [error] 26838#0: *1721 connect() failed (111: Connection refused) while connecting to upstream, client: 171.209.*.*, server: test.com, request: "GET /hls/Segment(158665165)/segment.ts HTTP/1.1", upstream: "http://180.149.*.*:80/hls/(158665165)/segment.ts", host: "61.139.*.*"

180.149.*.* 这个是 IIS 源站 IP
61.139.*.* 这个是 nginx 代理服务器 IP
imaning
2020-04-13 10:44:40 +08:00
我自己用域名挂阿里云 CDN 去访问源站,一个 502 都没有,不知道为啥。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/661404

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX