# Fastcgi\_next\_upstream settings and "Connection reset by peer" errors

**URL:** <https://www.ruby-forum.com/t/fastcgi-next-upstream-settings-and-connection-reset-by-peer-errors/223690>\
**Category:** NGINX\
**Created:** [October 14, 2012, 12:04pm UTC](https://www.ruby-forum.com/t/fastcgi-next-upstream-settings-and-connection-reset-by-peer-errors/223690 "2012-10-14T12:04:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 14, 2012, 12:04pm UTC](https://www.ruby-forum.com/t/fastcgi-next-upstream-settings-and-connection-reset-by-peer-errors/223690/1 "2012-10-14T12:04:35Z")

</div>

I have a nginx setup with a fastcgi upstream of 5 servers  
10.1.1.1 to 10.1.1.5

When a PHP has a long loop (which is due to bad php coding which is  
difficult to fix at this moment where the PHP process itself crashes),

The nginx fastcgi request loops through all the servers, for example the  
error logs show:  
2012/10/14 18:33:52 [error] 4478#0: \*900244 recv() failed (104:  
Connection  
reset by peer) while reading response header from upstream, client:  
122.32.55.139, server: [mydomain.com](http://mydomain.com), request: “GET /132727767 HTTP/1.1”,  
upstream: “fastcgi://10.1.1.1:9000”, host: “[www.mydomain.com](http://www.mydomain.com)”  
2012/10/14 18:34:06 [error] 4478#0: \*900244 recv() failed (104:  
Connection  
reset by peer) while reading response header from upstream, client:  
122.32.55.139, server: [mydomain.com](http://mydomain.com), request: “GET /132727767 HTTP/1.1”,  
upstream: “fastcgi://10.1.1.2:9000”, host: “[www.mydomain.com](http://www.mydomain.com)”  
2012/10/14 18:34:23 [error] 4478#0: \*900244 recv() failed (104:  
Connection  
reset by peer) while reading response header from upstream, client:  
122.32.55.139, server: [mydomain.com](http://mydomain.com), request: “GET /132727767 HTTP/1.1”,  
upstream: “fastcgi://10.1.1.3:9000”, host: “[www.mydomain.com](http://www.mydomain.com)”  
2012/10/14 18:34:36 [error] 4478#0: \*900244 recv() failed (104:  
Connection  
reset by peer) while reading response header from upstream, client:  
122.32.55.139, server: [mydomain.com](http://mydomain.com), request: “GET /132727767 HTTP/1.1”,  
upstream: “fastcgi://10.1.1.4:9000”, host: “[www.mydomain.com](http://www.mydomain.com)”  
2012/10/14 18:34:52 [error] 4478#0: \*900244 recv() failed (104:  
Connection  
reset by peer) while reading response header from upstream, client:  
122.32.55.139, server: [mydomain.com](http://mydomain.com), request: “GET /132727767 HTTP/1.1”,  
upstream: “fastcgi://10.1.1.5:9000”, host: “[www.mydomain.com](http://www.mydomain.com)”

Therefore I have tried  
fastcgi\_next\_upstream error;  
and  
fastcgi\_next\_upstream off;

But this does not seem to help… Am I missing something?
