How to fix "readv() failed (104: Connection reset by peer)" error in Nginx

"Connection reset by peer" error in Nginx:

[error] readv() failed (104: Connection reset by peer) while reading upstream, client: x.x.x.x, server: host.tld, request: "POST /script.php, ...

may occur because the following PHP parameters can cause the PHP process to end unexpectedly:

max_input_time = ...
max_execution_time = ...

It's suggested to increase these parameters.

Also if you use PHP-FPM there is a parameter request_terminate_timeout which determines the timeout for serving one request after which the process is terminated. In php-fpm.conf cnahge the value of request_terminate_timeout parameter to 600 seconds:

request_terminate_timeout = 600

Got a comment?

captcha =


  1. System (20)
    1. FreeBSD (5)
    2. Linux (9)
  2. Email (2)
  3. DNS (2)
  4. Databases (1)
  5. WebServer (27)
Copyright © 2024 HowToUnix - *nix Howtos and Tutorials
All Rights Reserved.