Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.