Connect () php-cgi.sockfailed (2: Nosuchfileordirectory) problem solved connect () php-cgi.sock failed (2: No such file or directory) problem solved
In the LMNP server architecture, after nginx and php services are configured, the following error occurs when accessing the home page of 127.0.0.1/index. php:
2339 connect() to unix:/home/xxx/php/var/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: xxxx
Check the configuration of nginx and php-fpm in case of the above problems:
1. in the nginx configuration file nginx. conf, find the place 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;}
Fastcgi_pass is the interaction path for configuring nginx and php-fpm.
Sock mode: fastcgi_pass unix:/home/xxx/php/var/php-cgi.sock;
Http: fastcgi_pass 127.0.0.1; 9000;
You can choose either of them, but it must be consistent with the configuration of php-fpm.
2. php-fpm configuration file php-fpm.conf, find where to configure the startup mode
127.0.0.1: 9000
... // Omit other configurations
The configuration 127.0.0.1: 9000 does not match the configuration unix:/home/xxx/php/var/php-cgi.sock in nginx, so an error is reported.
Modify the php-fpm configuration:
/home/xxx/php/var/php-cgi.sock
Or modify the nginx configuration:
fastcgi_pass 127.0.0.1;9000;
All of the above problems can be solved.
The above is the connect () php-cgi.sock failed (2: No such file or directory) to solve the problem of content, more related content please follow the PHP Chinese network (www.php1.cn )!