Apache: “AuthType not set!” 500 Error

后端 未结 6 1036
独厮守ぢ
独厮守ぢ 2021-01-30 02:10

It\'s been a while since I used the Apache httpd web server. I\'m firing up a local server for a project and when I try to request localhost/index.html, I get a 500 error and I

相关标签:
6条回答
  • 2021-01-30 02:27

    Just remove/comment the following line from your httpd.conf file (etc/httpd/conf)

    Require all granted

    This is needed till Apache Version 2.2 and is not required from thereon.

    0 讨论(0)
  • 2021-01-30 02:28

    I think that you have a version 2.4.x of Apache.

    Have you sure that you load this 2 modules ? - 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 : My recommendation for authorization and rights is (by default) :

    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
    
    0 讨论(0)
  • 2021-01-30 02:29

    Remove the line that says

    Require all granted
    

    it's only needed on Apache >=2.4

    0 讨论(0)
  • 2021-01-30 02:30

    Alternatively, this solution works with both Apache2 version < 2.4 as well as >= 2.4. Make sure that the "version" module is enabled:

    a2enmod version
    

    And then use this code instead:

    <IfVersion < 2.4>
        Allow from all
    </IfVersion>
    <IfVersion >= 2.4>
        Require all granted
    </IfVersion>
    
    0 讨论(0)
  • 2021-01-30 02:33

    You can try sudo a2enmod rewrite if you use it in your config.

    0 讨论(0)
  • 2021-01-30 02:44

    The problem here can be formulated another way: how do I make a config that works both in apache 2.2 and 2.4?

    Require all granted is only in 2.4, but Allow all ... stops working in 2.4, and we want to be able to rollout a config that works in both.

    The only solution I found, which I am not sure is the proper one, is to use:

    # backwards compatibility with apache 2.2
    Order allow,deny
    Allow from all
    
    # forward compatibility with apache 2.4
    Require all granted
    Satisfy Any
    

    This should resolve your problem, or at least did for me. Now the problem will probably be much harder to solve if you have more complex access rules...

    See also this fairly similar question. The Debian wiki also has useful instructions for supporting both 2.2 and 2.4.

    0 讨论(0)
提交回复
热议问题