Connect to unix:/var/run/php5-fpm.sock failed. What is wrong with my setup? Connect to unix:/var/run/php5-fpm.sock failed. What is wrong with my setup? wordpress wordpress

Connect to unix:/var/run/php5-fpm.sock failed. What is wrong with my setup?


The first problem is you are specifying 100 max_children, that is awfully high for 2GB. I would drop it to 25 children. See my post here on how to optimise your php-fpm configuration for your setup:

WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning

Also, using unix sockets is slightly faster since it provides you direct network access without any TCP/IP overhead. On the down side, it is not as scalable as TCP/IP. Nginx will throw 502 errors when the sockets have been depleted. In such a case you can either tweak the OS settings to accommodate the larger connection pool or just switch to switch to TCP/IP.

In your fastcgi conf change:

fastcgi_pass unix:/var/run/php5-fpm.sock;

to:

fastcgi_pass 127.0.0.1:9000;

Note that port 9000 is the default port set in php-fpm, if you have changed php-fpm to listen on another port then swap 9000 with that value. Make sure you restart both php-fpm and nginx.

Now, if after all of this, you still cannot get it to work and free -m returns high memory usage, then it is time to add more ram to your server.