Resource temporarily unavailable while connecting to upstream (php5-fpm)

Solution 1:

Unfortunately it is difficult to give definite answer to this question without more details.

I have a couple of guesses though:

My first guess is that your php5-fpm worker socket(s) have too small listen backlog for your load. The backlog queue length is 128 by default on Linux.

To increase it you should:

  1. Increase net.core.somaxconn sysctl value.
  2. Increase listen.backlog php5-fpm configuration setting.

You could try increasing both to 2048 for example to see if that helps.

My second guess is the per process maximum open file descriptors limit of the nginx workers. The proper way to increase it depends on your distribution. On Ubuntu/Debian you should have a look in /etc/default/nginx file and worker_rlimit_nofile nginx configuration setting.