Apache的权限被拒绝 [英] Apache permission denied

查看:443
本文介绍了Apache的权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了一个新的Apache 2.4.2与PHP快速CGI在Windows上构建。

I've just installed a new Apache 2.4.2 with Php fast cgi build on windows.

然后我修改httpd.conf中添加以下内容:

Then I modified the httpd.conf adding the following:

LoadModule fcgid_module modules/mod_fcgid.so  
FcgidInitialEnv PHPRC "C:/SITE/PHP"
AddHandler fcgid-script .php
FcgidWrapper "C:/SITE/PHP/php-cgi.exe" .php

DocumentRoot "C:/SITE/localhost/www"
<Directory "C:/SITE/localhost/www">
    Order allow,deny
    Allow from all
</Directory>

然而,当我尝试打开我的网站,它说:

However when I try to open my site, it says:

紫禁城您没有权限访问/在此服务器上。

任何想法可能是什么问题?

Any ideas what might be the problem?

推荐答案

这是正确的方式来做到这一点:(感谢DaveRandom)

This was the correct way to do it: (thanks to DaveRandom)

<Directory "C:/SITE/localhost/www">
    Options ExecCGI
    AllowOverride all
    Require all granted
</Directory>

戴夫随机进一步解释道:

这个一个小实验后,我发现,使这个正确的答案,这是针对Apache 2.3+的细微差别。看来, mod_authz_host 指令接管 mod_access_compat 指令precedence,而这个泡沫一路目录树。这意味着,如果要迁移来自Apache 2.2到Apache 2.4和您使用2.2 的httpd.conf 逐字,它会工作。

After a little experimentation with this, I have discovered the nuance that makes this the correct answer, which is specific to Apache 2.3+. It seems that mod_authz_host directives take precedence over mod_access_compat directives, and this bubbles all the way up the directory tree. What this means is that if you are migrating from Apache 2.2 to Apache 2.4 and you use your 2.2 httpd.conf verbatim, it will work.

不过,如果执行新安装的2.4和底座上的默认你的配置2.4 的httpd.conf 允许指令将无法正常工作,因为默认的顶层部分使用了要求所有被拒绝指令而不是所有,而这需要precedence过任何后续的允许指令上涨树。长短期的这种的是,如果你正在迁移订单/允许/拒绝指令到对应的需要,则必须有机会个个否则你会发现你得到你没想到403s。

If, however, you perform a new install of 2.4 and base your config on the default 2.4 httpd.conf, Allow directives won't work, because the default top level section uses a Require all denied directive instead of Deny from all, and this takes precedence over any subsequent Allow directives higher up the tree. The long of the short of this is that if you are migrating your Order/Allow/Deny directives to their equivalent Requires, then you must chance all of them or you will find you get 403s you weren't expecting.

这篇关于Apache的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆