V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
xuxuxu123
V2EX  ›  问与答

nginx 反向代理异常求助!感谢各位大佬

  •  
  •   xuxuxu123 · Apr 23, 2023 · 1030 views
    This topic created in 1107 days ago, the information mentioned may be changed or developed.
    场景是这样的:
    我司系统需要对接三方上游接口,并且访问频率较高,但是上游有 IP 白名单限制,遂部署一台 nginx 服务器专门做反代转发
    现异常情况:
    正常情况下,nginx 反向代理无异常,能够正常访问到上游
    但是运行几天之后就会报以下错误

    2163382957 connect() failed (110: Connection timed out) while connecting to upstream
    2163618488 upstream server temporarily disabled while connecting to upstream

    然后重启 nginx 之后又好了,请各位大佬提一提思路解决此问题
    小弟在此谢过
    4 replies    2023-04-24 11:23:21 +08:00
    jackyzy823
        1
    jackyzy823  
       Apr 23, 2023
    proxy_pass 里用的是域名吗?
    xuxuxu123
        2
    xuxuxu123  
    OP
       Apr 24, 2023
    @jackyzy823 是的
    jackyzy823
        3
    jackyzy823  
       Apr 24, 2023
    @xuxuxu123 有一种可能是这个域名指向的 IP 会变(例如使用 CDN ),而在 NGINX 里如果在 proxy_pass 里指定的是域名,那么只有在 NGINX 初始化的时候解析一次,后续就算域名指向的 IP 变了,NGINX 也不会再次解析。

    解决方法参考: https://community.f5.com/t5/technical-forum/does-nginx-1-20-or-newer-re-resolve-dns-for-proxy-pass/td-p/303654
    xuxuxu123
        4
    xuxuxu123  
    OP
       Apr 24, 2023
    @jackyzy823 感谢大佬;我看下
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2897 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 06:28 · PVG 14:28 · LAX 23:28 · JFK 02:28
    ♥ Do have faith in what you're doing.