Ubuntu 16.04 php 7.0 apache 无法正常工作

Ubuntu 16.04 php 7.0 apache 无法正常工作

我正在尝试让它工作,但没有成功,这是我的 apache 配置,如能帮助解决哪里出了问题,我将不胜感激。

<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName www.site.com
  DocumentRoot /var/www/sites/www.site.com/httpdocs
  ScriptAlias "cgi-bin" "/var/www/sites/www.site.com/cgi-bin"

  ErrorLog ${APACHE_LOG_DIR}/site.com.error_log

  LogLevel debug

  CustomLog ${APACHE_LOG_DIR}/www.site.com.log combined


    <IfModule mod_fastcgi.c>

    AddHandler php7-fcgi-kermit .php
    Action php7-fcgi-kermit /php7-fcgi-kermit
    Alias /php7-fcgi-kermit /usr/lib/cgi-bin/php7-fcgi-kermit
    FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-kermit -socket /run/php/php7.0-fpm.kermit.sock -pass-header Authorization

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


  <IfModule mod_fastcgi.c>
    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
      SetHandler php7-fcgi-kermit
    </FilesMatch>
  </IfModule>

</VirtualHost>

该网站根本无法运行,甚至没有在日志中抛出错误。它昨天确实抛出了这个错误

AH00128:文件不存在:/var/www/sites/www.site.com/php7-fcgi/wp-admin/install.php

更新:

我禁用了 000-default 站点并只留下了 vhost,现在它正在记录此错误。

[Tue Mar 20 13:57:40.661109 2018] [fastcgi:error] [pid 7060:tid 140644508116736] (13)Permission denied: [client xxx.xxx.xxx.xxx:49471] FastCGI: failed to connect to server "/usr/lib/cgi-bin/php7-fcgi-kermit": connect() failed
[Tue Mar 20 13:57:40.661130 2018] [fastcgi:error] [pid 7060:tid 140644508116736] [client xxx.xxx.xxx.xxx:49471] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php7-fcgi-kermit

我把conf的php部分改成如下:

<IfModule mod_fastcgi.c>

AddHandler php7-fcgi .php  
Action php7-fcgi /php7-fcgi  
Alias /php7-fcgi-kermit /usr/lib/cgi-bin/php7-fcgi-kermit  
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-kermit -socket /run/php/php7.0-fpm.kermit.sock -pass-header Authorization

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


<IfModule mod_fastcgi.c>

完成此操作后,我收到以下错误,但 fpm 正在运行并且 fastcgi 模块已加载

错误:PHP 未运行

有任何想法吗?

相关内容