nginx 的 upstream timed out 问题

nginx 作为负载服务,表现为网站访问很慢,有些文件或页面要等待到60s才会返回,我注意到60s就是超时时间,但是超时后返回状态是正常值200,网站可以正常打开,就是会一直等待到超时才打开,而且问题出现不定时,不定文件,静态文件也会出现这个问题。貌似很奇葩是吧,最终查看错误信息没有注意到 IPv6,导致饶了不少弯。

错误信息:

[error] 5292#5912: *3059 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 66.249.69.219, server: xxx.com, request: "GET /shop/view.jhtml HTTP/1.1", upstream: "http://[::1]:12002/shop/view.jhtml", host: "www.xxx.com"

配置如下:

    upstream zcun_pool {
        server localhost:12001 max_fails=1 fail_timeout=30s;
        server localhost:12002 max_fails=1 fail_timeout=30s;
        server localhost:12003 max_fails=1 fail_timeout=30s;
    }

发现可能是 IPv6 的问题后,改 localhost 为本地 IPv4 即可解决.....这错误说起来还真是低级~

    upstream zcun_pool {
        server 127.0.0.1:12001 max_fails=1 fail_timeout=30s;
        server 127.0.0.1:12002 max_fails=1 fail_timeout=30s;
        server 127.0.0.1:12003 max_fails=1 fail_timeout=30s;
    }

网站访问回复正常。

转载于:https://www.cnblogs.com/islee/p/6401639.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值