reddragdiva: (Default)
divabot ([personal profile] reddragdiva) wrote 2009-12-21 04:44 pm (UTC)

mod_macro - it's ace. I found it last month, we're using it on live and it's made our lives so much easier already.

(The author is absolutely determined it will not become Turing-complete - it does only very stupid substitution. He says if you want anything fancier, use Perl and abandon all hope.)

We have a pile of stuff like this in our apache/conf/ directories:

vhost-default.conf (relevant section, at end):

...
<Macro FOO_LOCAL_CUSTOM_LOG $APPLICATION $DOMAIN>
CustomLog "|/usr/local/apache/bin/rotatelogs /data/apache/$APPLICATION/logs/$DOMAIN_server0000123.server.not_access_log.%Y-%m-%d 86400" withcookies
</Macro>

<Macro FOO_SERVER_ALIAS_FARNARKLE>
ServerAlias farnarkle-04.host.example.com
</Macro>
Include conf/vhost-farnarkle.conf
...

httpd.conf (load the module, define the macro, use the macro)

 ...
LoadModule macro_module       modules/mod_macro.so
 ...
Include conf/vhost-default.conf
 ...
Include conf/vhost-farnarkle.conf
 ...

vhost-farnarkle.conf:

 ...
Use FOO_SERVER_ALIAS_FARNARKLE
 ...
Use FOO_LOCAL_CUSTOM_LOG farnarkle www.foofarnarkle.cam
 ...


Post a comment in response:

(will be screened)
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting