NGINX failed to connect to php-fpm socket

nginxphp-fpm

I use CentOS 6.5 (64bit) with Nginx, PHP-FPM. Nginx with FastCGI connect to PHP-FPM using unix domain socket. When I place the socket in a directory with proper permission, it's OK. However when I place the socket in the /tmp, it will cause nginx error:

In the error log of my VHOST i get :

connect() to unix:/tmp/MySite.sock failed (2: No such file or directory) while connecting to upstream

That's about all I've got so far. How can I fix this.

Best Answer

Check your PHP-FPM configuration for the listen directive and ensure it is where you need it (/tmp in this case).

Also ensure that the user/group for php-fpm and the user/group for the listen socket are set correctly (usually setting them to nginx is the way to go).

The socket should automatically be created when you start php-fpm. Do not create it by yourself.

Related Topic