imaning
V2EX  ›  问与答

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

  •  
  •   imaning · Apr 11, 2020 · 1653 views
    This topic created in 2234 days ago, the information mentioned may be changed or developed.
    测试直接访问源站 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 replies    2020-04-13 10:44:40 +08:00
    KasuganoSoras
        1
    KasuganoSoras  
       Apr 11, 2020   ❤️ 1
    把 Nginx 的报错发上来看看才知道是什么原因造成的 502 啊……
    imaning
        2
    imaning  
    OP
       Apr 12, 2020
    @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
       Apr 13, 2020
    我自己用域名挂阿里云 CDN 去访问源站,一个 502 都没有,不知道为啥。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2954 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 12:39 · PVG 20:39 · LAX 05:39 · JFK 08:39
    ♥ Do have faith in what you're doing.