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?

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;
| improve this answer | |
  • 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. – chris Feb 2 '14 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 Feb 2 '14 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.