# Connection timeout for upstream server!

**URL:** <https://www.ruby-forum.com/t/connection-timeout-for-upstream-server/238229>\
**Category:** NGINX\
**Created:** [December 26, 2013, 12:47pm UTC](https://www.ruby-forum.com/t/connection-timeout-for-upstream-server/238229 "2013-12-26T12:47:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [December 26, 2013, 12:47pm UTC](https://www.ruby-forum.com/t/connection-timeout-for-upstream-server/238229/1 "2013-12-26T12:47:28Z")

</div>

We’re having following issue with nginx and php-fpm, please have a look  
on  
logs :

2013/12/26 16:43:24 [error] 9906#0: \*37001 upstream timed out (110:  
Connection timed out) while reading response header from upstream,  
client:  
192.252.214.240, server: [search.com](http://search.com), request: “GET  
/search/es/index\_video.php?videoid=1593251&is\_updated=yes HTTP/1.1”,  
upstream: “fastcgi://127.0.0.1:9000”, host: “[search.com](http://search.com)”

Also tried increasing proxy timeout to 300 from nginx. When we telnet  
the  
port 9000, connection automatically closed after 4~5 seconds :

Trying 127.0.0.1…  
Connected to 127.0.0.1.  
Escape character is ‘^]’.  
Connection closed by foreign host.

we’ve also found slow logs in php-fpm :

[root@search ~]# tail -30 /var/log/php-fpm/search-slow.log  
[26-Dec-2013 16:44:48] [pool search] pid 10303  
script\_filename = /home/search/public\_html/search/es/index\_video.php  
[0x00000000015e0960] curl\_exec()  
/home/search/public\_html/search/es/index\_video.php:90

[26-Dec-2013 16:45:11] [pool search] pid 10302  
script\_filename = /home/search/public\_html/search/es/index\_video.php  
[0x00000000015e0960] curl\_exec()  
/home/search/public\_html/search/es/index\_video.php:90

[26-Dec-2013 16:45:18] [pool search] pid 10320  
script\_filename = /home/search/public\_html/search/es/index\_video.php  
[0x00000000015d8950] curl\_exec()  
/home/search/public\_html/search/es/index\_video.php:90

[26-Dec-2013 16:45:28] [pool search] pid 10311  
script\_filename = /home/search/public\_html/search/es/index\_video.php  
[0x00000000015e0960] curl\_exec()  
/home/search/public\_html/search/es/index\_video.php:73

[26-Dec-2013 16:45:34] [pool search] pid 10307  
script\_filename = /home/search/public\_html/search/es/index\_video.php  
[0x00000000015e2cd0] curl\_exec()  
/home/search/public\_html/search/vendor/ruflin/Elastica/lib/Elastica/Transport/Http.php:117  
[0x00000000015e2a20] exec()  
/home/search/public\_html/search/vendor/ruflin/Elastica/lib/Elastica/Request.php:165  
[0x00000000015e2568] send()  
/home/search/public\_html/search/vendor/ruflin/Elastica/lib/Elastica/Client.php:526  
[0x00000000015e2278] request()  
/home/search/public\_html/search/vendor/ruflin/Elastica/lib/Elastica/Bulk.php:269  
[0x00000000015e1fa0] send()  
/home/search/public\_html/search/vendor/ruflin/Elastica/lib/Elastica/Client.php:249  
[0x00000000015e1d20] addDocuments()  
/home/search/public\_html/search/vendor/ruflin/Elastica/lib/Elastica/Index.php:123  
[0x00000000015e1aa0] addDocuments()  
/home/search/public\_html/search/vendor/ruflin/Elastica/lib/Elastica/Type.php:161  
[0x00000000015e0960] addDocuments()  
/home/search/public\_html/search/es/index\_video.php:34

[26-Dec-2013 16:45:53] [pool search] pid 10322  
script\_filename = /home/search/public\_html/search/es/index\_video.php  
[0x00000000015e0960] curl\_exec()  
/home/search/public\_html/search/es/index\_video.php:90

Please help me.

Regards.  
Shahzaib
