Nginx 502 and recv() failed (104: Connection reset by peer)

12.83K views
0
0 Comments

Every so often Nginx will start returning 502 errors for some of my web applications. When I check the log, they’re full of lines like these:

2015/06/28 10:36:55 [error] 1139#0: *4959 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: [myip], server: [mysite], request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "[mysite]", referrer: "[mysite]/wp-admin/admin.php?page=bpmemberonly"
2015/06/28 10:37:58 [error] 1139#0: *4964 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: [myip], server: [mysite], request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "[mysite]", referrer: "[mysite]/wp-admin/"

Restarting PHP-FPM seems to temporarily fix the problem until it happens again. I’ve only noticed it when I’ve been doing a lot of testing with JavaScript and AJAX on my sites. I haven’t been able to find a permanent solution yet there. Any ideas?

0
Anonymous 0 Comments

http://dongshengsw.com/img/Marlboro-340.htmlhttp://dongshengsw.com/img/Marlboro-340.html
http://casacucina.net/img/adidas-486.html http://casacucina.net/img/adidas-486.html

0
Anonymous 0 Comments

http://ibuiltgroup.com.au/img/Marlboro-771.htmlhttp://ibuiltgroup.com.au/img/Marlboro-771.html
http://decorclubonline.com/uploads/adidas-43.html http://decorclubonline.com/uploads/adidas-43.html

0
Anonymous 0 Comments

[url=http://nexium.link/]nexium[/url]

0

I’ve seen timeouts and buffer sizes both blamed for these 502 errors.

Adjust your buffers: fastcgi_buffer_size, fastcgi_buffers, proxy_buffer_size, proxy_buffers

Increase timeouts if necessary, keeping them in line with what you have in php.ini: fastcgi_connect_timeout, fastcgi_send_timeout, fastcgi_read_timeout