title: Connect to unix:/var/run/php5-fpm.sock failed. What is wrong with my setup?
body: <p>I have a 2GB VPS on DigitalOcean and I am hosting WordPress 3.9.1 under Debian 7 with NGINX, php-fpm and unix socket.</p>
  
  <p>It was working perfectly until last week it started showing a "502 bad gateway" error. I checked the logs and found that:</p>
  
  <blockquote>
    <p>php5-fpm log is showing pm.max_children was reached and
    nginx log is showing the following:</p>
    
    <p>[error] 3239#0: *15188 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: xxx.xxx.xxx.xxx, server: my.domain, request: "POST /xmlrpc.php HTTP/1.0", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxx.xxx.xxx.xxx"</p>
  </blockquote>
  
  <p>I manually changed pm with different settings with no luck. I always restart the daemons after every change.</p>
  
  <p>pm settings are:</p>
  
  <pre><code>pm = dynamic 
  pm.max_children = 100 
  pm.start_servers = 10 
  pm.min_spare_servers = 10 
  pm.max_spare_servers = 10 
  pm.max_requests = 200
  </code></pre>
  
  <p><code>www.conf</code> has the <code>listen = /var/run/php5-fpm.sock</code> enabled.</p>
  
  <p>Anyone with a similar experience?</p>