V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
imaning
V2EX  ›  问与答

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

  •  
  •   imaning · 2020-04-11 12:00:43 +08:00 · 1192 次点击
    这是一个创建于 1475 天前的主题,其中的信息可能已经有所发展或是发生改变。
    测试直接访问源站 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;
    3 条回复    2020-04-13 10:44:40 +08:00
    KasuganoSoras
        1
    KasuganoSoras  
       2020-04-11 17:13:20 +08:00   ❤️ 1
    把 Nginx 的报错发上来看看才知道是什么原因造成的 502 啊……
    imaning
        2
    imaning  
    OP
       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
        3
    imaning  
    OP
       2020-04-13 10:44:40 +08:00
    我自己用域名挂阿里云 CDN 去访问源站,一个 502 都没有,不知道为啥。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5392 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 07:46 · PVG 15:46 · LAX 00:46 · JFK 03:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.