首页 文章

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

提问于
浏览
90

自从我使用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 回答

  • 0

    或者,此解决方案适用于Apache2版本<2.4以及> = 2.4 . 确保已启用“版本”模块:

    a2enmod version
    

    然后使用此代码:

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

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

    要求全部授予

    这需要直到Apache 2.2版,并且不需要 .

  • 44

    删除说的行

    Require all granted
    

    它只需要Apache> = 2.4

  • 0

    这里的问题可以用另一种方式表达:如何在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

    我认为你有一个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
    
  • 32

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

相关问题