How to fix "upstream timed out (110: Connection timed out) while reading" error in Nginx and PHP-FPM

"Upstream timed out (110: Connection timed out) while reading upstream" error may occur when it takes more than 60 seconds for PHP-FPM backend to respond.

[error] upstream timed out (110: Connection timed out) while reading upstream, client: x.x.x.x, server: howtounix.info, request: "GET /script.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000"

Upstream timed out error happens if you have long running fastcgi processes, for example parsing large XML or CVS files, that do not produce output until they have finished processing. Nginx waits for fastcgi backend to respond for 60 seconds by default. If it takes more than that, the request is stopped.

You can fix this problem by changing the value of fastcgi_read_timeout parameter in nginx.conf. fastcgi_read_timeout directive sets the amount of time for upstream to wait for a fastcgi process to send data. To handle long running fastcgi processes increase this parameter to 600 seconds:

http {
    ...
    fastcgi_read_timeout 600s;
    ...
}

This should help to fix the problem.








Got a comment?
Name (optional):
Comment
Anti-Bot:captcha =
 
 
Copyright © 2012-2013 HowToUnix - *nix Howtos and Tutorials
All Rights Reserved.