0

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?

Abhijeet Kasurde
  • 985
  • 9
  • 20
MaxBro57
  • 37
  • 7

1 Answers1

0

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 = 127.0.0.1:9000

and/or :

netstat -anp | grep -i fpm | grep -i listen
tcp     0      0 127.0.0.1:9000        0.0.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 = 127.0.0.1:9000

But modify your Nginx vhost like this :

fastcgi_pass 127.0.0.1:9000;

Option 2 :

Keep your Nginx vhost unchanged :

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

But modify your www.conf like this :

;listen = 127.0.0.1:9000
listen = /var/run/php-fpm.sock;
krisFR
  • 12,830
  • 3
  • 31
  • 40
  • Thank you . When I added `listen = 127.0.0.1:9000`, 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 Feb 02 '14 at 02: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 Feb 02 '14 at 12:30