Connect () php-cgi.sockfailed (2: Nosuchfileordirectory) issue resolved

Source: Internet
Author: User
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 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; 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
   ... // Omit other configurations

The configuration 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:


Or modify the nginx configuration:


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 ( )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.