监听 127.0.0.1:9000 但 var/run/php5-fpm.sock 失败(2:没有此文件或目录)

监听 127.0.0.1:9000 但 var/run/php5-fpm.sock 失败(2:没有此文件或目录)

我有一个配置为接受 127.0.0.1:9000 的 FastCGI 请求,如下所示。

/etc/php5/fpm/pool.d/www.conf

listen = 127.0.0.1:9000

/etc/nginx/sites-enabled/mysite

location ~ .php$ 
{
    if (!-e $request_filename) 
    {
        rewrite / /index.php last;
    }

    expires  off;
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param MAGE_RUN_CODE $mage_code;
    fastcgi_param MAGE_RUN_TYPE $mage_type;
    include fastcgi_params;
}

但是,我查看了 Nginx 错误日志,发现一直出现此错误:

connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream

什么原因导致此错误?此套接字文件在此服务器上不可用。

注意:当我这样做时$ sudo grep -r unix:/var/run/php5-fpm.sock /etc/nginx

/etc/nginx/sites-available/mysite.20160330:    fastcgi_pass  unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/mysite.20160330:    fastcgi_pass  unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/default:            #fastcgi_pass unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/mysite:             #fastcgi_pass  unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/mysite:             #fastcgi_pass  unix:/var/run/php5-fpm.sock;    

相关内容