Connect () Php-cgi.sock failed (2:no such file or directory) problem resolution
In the LMNP server architecture, when you configure the nginx,php service, the following error occurs when you access the 127.0.0.1/index.php home page:
2339 Connect () to Unix:/home/xxx/php/var/php-cgi.sock failed (2:no such file or directory) while connecting to upstream, Client:xxxx
Please check the configuration of Nginx and PHP-FPM for the above problems:
1.nginx configuration file nginx.conf, locate the location where the PHP-FPM path is configured
Location ~\.php$ { root/home/xxxx; Fastcgi_pass Unix:/home/xxx/php/var/php-cgi.sock; Fastcgi_index index.php; Include fastcgi.conf;}
One of the Fastcgi_pass is to configure Nginx and php-fpm Interactive path, there are generally two ways
Sock way: Fastcgi_pass Unix:/home/xxx/php/var/php-cgi.sock;
HTTP mode: Fastcgi_pass 127.0.0.1;9000;
Choose one of these, but it must be consistent with the PHP-FPM configuration.
2.PHP-FPM configuration file php-fpm.conf, find where to configure the startup mode
<workers> <section> <value name= "listen_address" >127.0.0.1:9000</value> ...// Omit other configurations </section> </workers>
The configuration for 127.0.0.1:9000 and Nginx configuration Unix:/home/xxx/php/var/php-cgi.sock does not match, so cause error.
Modify the PHP-FPM configuration to:
/home/xxx/php/var/php-cgi.sock
or modify the Nginx configuration to:
Fastcgi_pass 127.0.0.1;9000;
Can solve the above problems.
This is the solution to connect () Php-cgi.sock failed (2:no such file or directory), more about topic.alibabacloud.com (www.php.cn)!