自从我使用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”有关 . 我不知道这些意味着什么或从哪里开始挖掘 .
谷歌的一项基本搜索显示this link,表明罪魁祸首可能是"Require all granted" . 我的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 回答
或者,此解决方案适用于Apache2版本<2.4以及> = 2.4 . 确保已启用“版本”模块:
然后使用此代码:
只需从httpd.conf文件中删除/注释以下行(etc / httpd / conf)
要求全部授予
这需要直到Apache 2.2版,并且不需要 .
删除说的行
它只需要Apache> = 2.4
这里的问题可以用另一种方式表达:如何在apache 2.2和2.4中进行配置?
Require all granted
仅在2.4中,但是Allow all ...
在2.4中停止工作,我们希望能够推出一个适用于两者的配置 .我发现的唯一解决方案,我不确定是正确的解决方案,是使用:
这应该解决你的问题,或者至少对我有用 . 现在,如果您有更复杂的访问规则,问题可能会更难解决......
另见this fairly similar question . Debian wiki也有useful instructions for supporting both 2.2 and 2.4 .
我认为你有一个Apache的2.4.x版本 .
你确定加载这2个模块吗? - mod_authn_core - mod_authz_core
PS:我的授权和权利建议是(默认情况下):
如果您在配置中使用它,可以尝试
sudo a2enmod rewrite
.