Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an apache instance serving different locations, eg

https://host.com/jira
https://host.com/svn
https://host.com/websvn
https://host.com/phpmyadmin

Each of these has access control rules based on IP address/hostname. Some of them use the same configuration though, so I have to repeat the same rules each time:

Order Deny,Allow
Deny from All
Allow from 10.35 myhome.com mycollegueshome.com

Is there a way to make these reusable so that I don't have to change each instance everytime something changes? Ie, can I write this once, then use it for a couple of locations? Using SetEnvIf maybe? It would be nice if I could do something like this pseudo-config:

<myaccessrule>
  Order Deny,Allow
  Deny from All
  Allow from 10.35 myhome.com mycollegueshome.com
</myaccessrule>

<Proxy /jira*>
  AccessRule = myaccessrule
</Proxy>

<Location /svn>
  AccessRule = myaccessrule
</Location>

<Directory /websvn>
  AccessRule = myaccessrule
</Directory>
share|improve this question

2 Answers 2

up vote 3 down vote accepted

You're after mod_macro.

http://cri.ensmp.fr/~coelho/mod_macro/

share|improve this answer
    
exactly what I'm after. Thanks! –  stijn Jan 5 '11 at 11:10

If you're already using mod_perl, remember that mod_perl wraps the config bits of Apache as well as the data serving bits.

http://perl.apache.org/start/tips/config.html

share|improve this answer
    
interesting as well. Unfortunately my perl skill level is like zero :] –  stijn Jan 5 '11 at 17:02

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.