nginx 的 upstream timed out 问题
2024-10-15 02:07:50
nginx 作为负载服务,表现为网站访问很慢,有些文件或页面要等待到60s才会返回,我注意到60s就是超时时间,但是超时后返回状态是正常值200,网站可以正常打开,就是会一直等待到超时才打开,而且问题出现不定时,不定文件,静态文件也会出现这个问题。貌似很奇葩是吧,最终查看错误信息没有注意到 IPv6,导致饶了不少弯。
错误信息:
[error] #: * upstream timed out (: 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: max_fails= fail_timeout=30s;
server localhost: max_fails= fail_timeout=30s;
server localhost: max_fails= fail_timeout=30s;
}
发现可能是 IPv6 的问题后,改 localhost 为本地 IPv4 即可解决.....这错误说起来还真是低级~
upstream zcun_pool {
server 127.0.0.1: max_fails= fail_timeout=30s;
server 127.0.0.1: max_fails= fail_timeout=30s;
server 127.0.0.1: max_fails= fail_timeout=30s;
}
网站访问回复正常。
最新文章
- jq
- CE程序
- tomcat组成及工作原理
- September 2nd 2016 Week 36th Friday
- APP发布Xcode7
- How to Map Distinct Value Types Using Java Generics--reference
- (转)发现两个有用的C函数_alloca()、_msize()
- SSH连接不上
- 前端基于JQgrid实现自定义列头展示
- C#设计模式(0)-认识设计模式
- Spring Boot配置拦截器及实现跨域访问
- Windows下自带压缩文件工具之-makecab
- 微信小程序--录音
- js源生ajax
- javaBean中 字符串 转 date 类型转换
- 在 laravel 的 DB::transaction 中,为外部变量赋值
- html5-常用的3个基本标签
- c#语言集合分析
- hdu3037——卢卡斯定理
- block本质探寻四之copy