Apache:“AuthType未设置!” 500错误

时间:2014-01-21 17:33:36

标签: apache

我使用Apache httpd Web服务器已经有一段时间了。我正在为一个项目启动本地服务器,当我尝试请求localhost / index.html时,我收到500错误,我在错误日志中看到了这一点:

[Tue Jan 21 09:23:58 2014] [crit] [client ::1] configuration error:  couldn't perform authentication. AuthType not set!: /index.html
[Tue Jan 21 09:23:58 2014] [error] an unknown filter was not added: DEFLATE
[Tue Jan 21 09:23:58 2014] [crit] [client ::1] configuration error:  couldn't perform authentication. AuthType not set!: /favicon.ico

看起来apache配置中可能有2个错误,其中一个与“AuthType未设置!”有关。可能还有一个与“过滤器没有添加:DEFLATE”有关。我不知道这些意味着什么或从哪里开始挖掘。

基本的Google搜索显示this link,表明罪魁祸首可能是“需要全部授权”。可能涉及我的httpd.conf中的这一行。

<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

这个apache配置主要是在这个项目的生产中使用的,所以我知道这有效,但目前我的工作站上没有。这意味着什么,我接下来应该尝试什么?我确实尝试评论“需要所有授予”并重新启动apache但无济于事。

关注this SO question我还加载了mod_authz_host

LoadModule authz_host_module modules/mod_authz_host.so

并添加“Allow from all”,重新启动服务器。但问题仍然存在。 deflate问题似乎是无关的,并且可以通过添加

轻松解决
LoadModule deflate_module modules/mod_deflate.so

问题仍然存在,如何解决这500错误?

[Tue Jan 21 09:44:20 2014] [crit] [client ::1] 
configuration error:  couldn't perform authentication. 
AuthType not set!: /index.html

6 个答案:

答案 0 :(得分:175)

删除显示

的行
Require all granted

仅在Apache&gt; = 2.4

上需要它

答案 1 :(得分:44)

这里的问题可以用另一种方式表达:如何在apache 2.2和2.4中进行配置?

Require all granted仅在2.4中,但Allow all ...在2.4中停止工作,我们希望能够推出一个适用于两者的配置。

我发现的唯一解决方案是使用:

,我发现这个解决方案是正确的
# backwards compatibility with apache 2.2
Order allow,deny
Allow from all

# forward compatibility with apache 2.4
Require all granted
Satisfy Any

这应该解决你的问题,或者至少对我有用。现在,如果您有更复杂的访问规则,问题可能会更难解决......

另见this fairly similar question。 Debian wiki也有useful instructions for supporting both 2.2 and 2.4

答案 2 :(得分:32)

或者,此解决方案适用于Apache2版本&lt; 2.4以及&gt; = 2.4。确保已启用“版本”模块:

a2enmod version

然后使用此代码:

<IfVersion < 2.4>
    Allow from all
</IfVersion>
<IfVersion >= 2.4>
    Require all granted
</IfVersion>

答案 3 :(得分:3)

只需从httpd.conf文件(etc / httpd / conf)中删除/注释以下行

要求所有已授予

在Apache 2.2版之前,这是必需的,从此以后不需要。

答案 4 :(得分:0)

我认为您有Apache的2.4.x版本。

您确定要加载这2个模块吗?   - mod_authn_core   - mod_authz_core

LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_core_module modules/mod_authz_core.so

PS:我的授权和权利建议是(默认情况下):

LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so

答案 5 :(得分:0)

如果您在配置中使用它,可以尝试sudo a2enmod rewrite

相关问题