I have a CentOS, Apache and Nginx installation. It uses php 5 handler as fcgi. This server uses WHM cpanel and easyapache. fcgi apply by using easyapache. These installation done by my hosting company. When I'm adding following code to Nginx vhost it giving me No such file or directory error.

    location ~ .php$ {
            try_files $uri /index.php;
            include fastcgi_params;
            fastcgi_pass unix:/var/run/php5-fpm.sock;

When I'm searching .sock file in the server, it don't display .sock extension file. How to I find the correct fastcgi_pass directory and file in ths VPS?

1 Answer 1


My guess is that php-fpm daemon is certainly binded to a TCP port and not a Unix socket.

Open your www.conf file and check if you have something like this :

listen =

and/or :

netstat -anp | grep -i fpm | grep -i listen
tcp     0      0*     LISTEN      2640/php-fpm

On my CentOS 6.5, file www.conf is located here : /etc/php-fpm.d/www.conf. It could be a different location on your system. Search for it !

If php-fpm is binded to a TCP port, you have 2 options :

Option 1 :

Keep your www.conf unchanged :

listen =

But modify your Nginx vhost like this :


Option 2 :

Keep your Nginx vhost unchanged :

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

But modify your www.conf like this :

;listen =
listen = /var/run/php-fpm.sock;
  • Thank you . When I added listen =, it gives invalid host in upstream error. When I'm running netstat -anp | grep -i fpm | grep -i listen command, it doesn't give any response. My VPS I can't find 'www.conf' file. Are you talking about httpd.conf file? My VPS company still uses CENTOS 6.4 i686 virtuozzo, not the 6.5. Also I can't find php-fpm.d directory in my file system. Do you have any idea about this situation? My php handler (fcig) enabled using EasyApache and it uses Apache suEXEC.
    – MaxBro57
    Commented Feb 2, 2014 at 2:28
  • @chris I am really talking talking about www.conf, not httpd.conf. Are you sure php-fpm is installed on your system ? What gives you ps -ef | grep -i fpm ? and yum list installed | grep -i fpm ?
    – krisFR
    Commented Feb 2, 2014 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .