RequireAny apache2 error

moesef asked:

I am trying to use RequireAny to allow acces to a site from either a certain IP or with a certain username. However, when I try to run apache I get the following error:

Invalid command '<RequireAny', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.

The part of my apache file with authentication looks like this:

<Directory /var/www/web/>
    Options Indexes FollowSymLinks

    AllowOverride AuthConfig FileInfo Options
    AcceptPathInfo On
    AuthName "Protected Site"
    AuthType Basic
    AuthBasicProvider file
    AuthUserFile /etc/apache2/.htpasswd

    <RequireAny>
            Require user dev
            Require ip 71.198.111.188
    </RequireAny>

        #Order allow,deny
        #allow from all
</Directory>

Why am I getting an error when using RequireAny in this case?

My answer:


The <RequireAny> and Require directives that you’re trying to use were added in Apache 2.4 and are in the mod_authz_core module. They are not available in Apache 2.2.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.