NGINX + PHP FPM connect() failed (110: Connection timed out) while connecting to upstream

Posted by Leonard Teo on Server Fault See other posts from Server Fault or by Leonard Teo
Published on 2012-02-23T21:35:51Z Indexed on 2012/10/30 23:05 UTC
Read the original article Hit count: 473

Filed under:
|
|

We're running a fairly large site using nginx and PHP-FPM and we're getting a lot of errors as the site load is quite high. We're getting "connect() failed (110: Connection timed out) while connecting to upstream"...upstream: "fastcgi://127.0.0.1:9000"

Here's my config file for PHP-FPM.

PHP-FPM:

[www]
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
user = nginx
group = nginx
pm = dynamic
pm.max_children = 100
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 100

slowlog = /var/log/php-fpm/www-slow.log

php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on

What's the recommended config/number of servers/children for a high traffic site?

We tried using Unix Sockets instead of TCP and got no noticeable improvements. Right now the errors are: connect() to unix:/var/run/php-fcgi.sock failed (11: Resource temporarily unavailable) while connecting to upstream...upstream: "fastcgi://unix:/var/run/php-fcgi.sock:"...

Thanks,

Leonard

© Server Fault or respective owner

Related posts about php

Related posts about nginx