首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Ubuntu服务器上的Apache 2.4.6 :客户端被服务器配置拒绝(PHP FPM) [加载PHP文件时]

Ubuntu服务器上的Apache 2.4.6 :客户端被服务器配置拒绝(PHP FPM) [加载PHP文件时]
EN

Stack Overflow用户
提问于 2013-10-18 17:05:45
回答 11查看 143.8K关注 0票数 68

今天我更新了Ubuntu server 13.04 (响尾蛇)和13.10 (萨西蜥蜴)。

我的Apache2安装坏了。

下面是我的配置:

文件error.log

[Fri Oct 18 10:48:07.237170 2013] [:notice] [pid 8292:tid 139804677900160] FastCGI: process manager initialized (pid 8292)
[Fri Oct 18 10:48:07.241185 2013] [mpm_event:notice] [pid 8289:tid 139804677900160] AH00489: Apache/2.4.6 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations
[Fri Oct 18 10:48:07.241652 2013] [core:notice] [pid 8289:tid 139804677900160] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 18 10:48:28.313923 2013] [authz_core:error] [pid 8294:tid 139804573181696]   [client 81.219.59.75:3536] AH01630: client denied by server configuration: /usr/lib/cgi-bin/php5-fcgi

文件default.conf

#EU
<VirtualHost *:80>
    #ServerName
    DocumentRoot /var/www/dev_stable

    DirectoryIndex index.php index.html index.htm

    <Directory /var/www/dev_stable>
          Options Indexes FollowSymLinks MultiViews

          AllowOverride all
          Require all granted
    </Directory>
</VirtualHost>

文件mods-enabled/fastcgi.conf

#<IfModule mod_fastcgi.c>
#  AddHandler fastcgi-script .fcgi
# FastCgiWrapper /usr/lib/apache2/suexec
#  FastCgiIpcDir /var/lib/apache2/fastcgi
#</IfModule>


<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
</Ifmodule>

当我尝试通过浏览器加载文件时,我得到了:

site_name/TEST/

Forbidden

You don't have permission to access /php5-fcgi/TEST/index.php on this server.

我该怎么解决它呢?

EN

回答 11

Stack Overflow用户

回答已采纳

发布于 2013-10-18 22:18:08

我也有同样的问题。我在本地机器上运行了几个虚拟主机进行开发。

首先,我更改了/etc/apache2/conf-available/php5-fpm.conf。我替换了每一个

Order Deny,Allow
Deny from all

Require all granted

配置必须由a2enconf php5-fpm启用。我对我的虚拟主机配置执行了相同的操作,并进行了替换。

出于安全原因,我不建议这样做,但只要我只将服务器用于本地目的,我就可以接受它。

票数 115
EN

Stack Overflow用户

发布于 2014-04-11 07:34:28

我在新安装Apache2.4时遇到了这个问题。经过几个小时的googling搜索和测试,我终于发现我还必须允许访问包含Alias指令的(不存在的)目标的目录。也就是说,这对我很有效:

# File: /etc/apache2/conf-available/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

    # NOTE: using '/usr/lib/cgi-bin/php5-cgi' here does not work,
    #   it doesn't exist in the filesystem!
    <Directory /usr/lib/cgi-bin>
        Require all granted
    </Directory>
</Ifmodule>
票数 40
EN

Stack Overflow用户

发布于 2013-10-19 06:36:17

我今天遇到了类似的问题(但在mod_wsgi上)。这可能是Apache2.2到2.4的问题。可以在here上找到更改的全面列表。

对我来说,这有助于为错误日志抱怨的每个路径添加一个额外的<Directory>-entry,并用Require all granted填充该部分。

所以在你的情况下,你可以尝试

<Directory /usr/lib/cgi-bin/php5-fcgi>
    Require all granted
    Options FollowSymLinks
</Directory>

我不得不将我的配置文件从conf.d文件夹移到sites-enabled文件夹。

总而言之,这对我来说很有效,但我不能保证它在你的情况下也是有效的。

票数 22
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19445686

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档