I'd like to protect multiple directories with mod_digest with one settings.
Currently I have this /etc/apache2/conf.a/mod-digest_realm-protected.conf
AuthType Digest
AuthName "protected"
AuthDigestDomain /adminer/ /school-project/
AuthDigestNonceLifetime 300
AuthDigestProvider file
AuthUserFile /etc/apache2/.digest
Require valid-user
and this in /etc/apache/sites-available/default
<Directory /var/www/adminer/>
Include /etc/apache2/conf.a/mod-digest_realm-protected.conf
</Directory>
<Directory /var/www/school-project/>
Include /etc/apache2/conf.a/mod-digest_realm-protected.conf
</Directory>
Is there a way to have this setting in a single config file? I tried something like this
<Directory /var/www/(adminer/school-project)/>
... auth_digest settings
</Directory>
but it doesn't work.
<IfModule> is simply a directive that tests the condition "is the named module loaded by apache httpd" (in your example mod_expires). It allows people to produce conditional based configuration for different installations where certain modules may be present or not.
The usage is straightforward - you would use Location if you need to fine tune access rights by an URL, and you would use Directory if you need to control access rights to a directory (and its subdirectories) in the filesystem.
ServerRoot. The ServerRoot directive specifies the top-level directory containing website content. By default, ServerRoot is set to "/etc/httpd" for both secure and non-secure servers.
try this
<Directory /var/www/>
... auth_digest settings
</Directory>
Regex can be used with Directory directive.
http://httpd.apache.org/docs/current/en/mod/core.html#directory
If you just want to protect some of them, I think this should work.
<Directory ~ "(adminer|school-project)"/>
... auth_digest settings
</Directory>
DirectoryMatch also works
<DirectoryMatch ^/var/www/(adminer|school-project)>
...
</DirectoryMatch>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With