PHP-FPM 无法连接到 FastCGI 服务器

Jer*_*emy 5 php apache fastcgi

所以我第一次设置 PHP5-FPM,一开始一切都很顺利,我可以看到我的网站启动并运行,直到我做了一些调整

/etc/php5/fpm/pool.d/www.conf
Run Code Online (Sandbox Code Playgroud)

具体在这些方面:

pm.max_children = 100 # The hard-limit total number of processes allowed
pm.start_servers = 20 # When nginx starts, have this many processes waiting for requests
pm.min_spare_servers = 10 # Number spare processes nginx will create
pm.max_spare_servers = 20 # Number spare processes attempted to create
pm.process_idle_timeout = 10s;
Run Code Online (Sandbox Code Playgroud)

当我重新启动 apache 和 php5-fpm 服务时,出现以下错误:

[Wed Nov 25 02:39:43.973654 2015] [fastcgi:error] [pid 5438] (2)No such file or directory: [client 36.72.129.207:60098] FastCGI: failed to connect to server "/usr/lib/cgi-bin/php5-fcgi": connect() failed
[Wed Nov 25 02:39:43.973705 2015] [fastcgi:error] [pid 5438] [client 36.72.129.207:60098] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php5-fcgi"
Run Code Online (Sandbox Code Playgroud)

所以我认为这是因为我没有使用 UNIX 套接字连接,所以我再次检查了我的 www.conf 文件:

我可以验证:

listen = /var/run/php5-fpm.sock
Run Code Online (Sandbox Code Playgroud)

我的 php5-fpm.conf 如下:

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization

<Directory /usr/lib/cgi-bin>
    Require all granted
</Directory>

</IfModule>
Run Code Online (Sandbox Code Playgroud)

而我的apache2.conf如下:

<IfModule fastcgi_module>
  # Add a new action that points to a virtual (non-existent) handler.
  # I will repeat, NON-EXISTENT. This is a virtual (non-existent) handler.
  #   i.e. `/fastcgi.php5-fpm` does not exist, that's OK :-)
  # The name of our handler is decided here. Let's call it `fastcgi-php5-fpm`.
  # See also <http://httpd.apache.org/docs/current/mod/mod_actions.html#action>

  Action fastcgi-php5-fpm /fastcgi.php5-fpm virtual

  # Now let's add an alias mapping that gives meaning to our virtual handler.
  # This forwards requests hitting our virtual (non-existent) handler;
  # sending them to FastCGI; which is yet another virtual handler.
  # I repeat, NON-EXISTENT. This is a virtual handler that does not exist.
  #   i.e. `/var/www/cgi-bin/fastcgi.php5-fpm` does not exist, that's OK :-)
  # See also <http://httpd.apache.org/docs/current/mod/mod_alias.html#alias>

  Alias /fastcgi.php5-fpm /var/www/cgi-bin/fastcgi.php5-fpm

  # Now, let's setup FastCGI so it works w/ our virtual handler and PHP5-FPM.
  # See also <http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiExternalServer>

  FastCgiExternalServer /var/www/cgi-bin/fastcgi.php5-fpm -socket /var/run/php5-fpm.sock -idle-timeout 900 -pass-header Authorization -pass-he$

  # Associate our handler with PHP files; including PHAR files.

  AddHandler fastcgi-php5-fpm php phar
</IfModule>
Run Code Online (Sandbox Code Playgroud)

我仍然不明白为什么我的 Apache 突然给我 500 错误,说它无法连接,而 5 分钟前,它确实...

谁能帮我解决这个问题吗...