[PHP-FPM] recv() failed (104: Connection reset by peer)

Tadashi Shigeoka ·  Sun, September 15, 2013

A problem occurred with frequent 502 bad gateway errors in an Nginx + PHP-FPM configuration.

Error Log

2013/09/15 19:02:06 [error] 2281#0: *23 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 125.1.92.146, server: codenote.net, request: "GET /php/1322.html HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/www.sock:", host: "codenote.net"

The cause was that request_terminate_timeout was too short, so I resolved it by changing it to 120 seconds.

# vim /etc/php-fpm.d/www.conf
request_terminate_timeout = 120s

Reference Information

ブログが表示されなくなる(nginx+WordPressで500エラー) | 魚座時代

Network is unreachable: nginx+PHP-FPMでどこまでチューニングできるか

That’s all from the Gemba.