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://"

Here's my config file for PHP-FPM.


listen =
listen.allowed_clients =
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:"...



1 Answer 1


Use unix sockets, instead of TCP/IP. So, you'd do something like:

listen = /tmp/php.sock

If you don't want to do something like that, check your firewall rules. If you're using any sort of conntrack rules, you could easily be filling up the table for that. See if there's any log messages in dmesg about it. You shouldn't really be using conntrack on a high-load server, so disabling that is probably a good idea.

Also, check your ulimit settings. If the number of open files is set too low, you could run into issues.

  • Hi we had actually switched over from using Unix sockets to TCP as the issue was happening on Unix Sockets. I've switched back to Unix sockets with no noticeable improvement. We're also looking into caching using Varnish... Feb 24, 2012 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.