httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <>
Subject Re: [users@httpd] Re-use of a Setenv directive
Date Wed, 20 Oct 2010 15:58:31 GMT
On 20.10.2010 17:04, Igor Galić wrote:
> ----- "J.Lance Wilkinson"<>  wrote:
>> Rainer Jung wrote:
>>> If the values are in fact static, i.e. do not depend in the request,
>>> virtual host etc., you can actually use the fact, that Apache allows
>> you
>>> to resolve unix environment variables (not the same as Apache
>>> environment variables) inside the Apache configuration. The syntax
>> is
>>> ${VARNAME} (do not drop the curly braces).
>>> - Set env var outside of Apache before starting:
>>> BASE_PATH=/var/smthg
>>> export BASE_PATH
>>> Use variable inside Apache config:
>>> SetEnv PATHS ${BASE_PATH}/a:${BASE_PATH}/b:${BASE_PATH}/c:...
>> 	Is this post-Apache 2.2.x functionality, or are you talking about
>> 	mod_define to get this functionality?
> Nope. That's in 2.2 -- it's (heavily) (ab)used by Distros like
> Debian and their like.

... and it was finally documented after being a secret for many years:

> Also, what's mod_define?

That's a module that lets your define variables inside Apache 
configuration. They are resolved with the same syntax ${XXX}. The 
difference to the shell environment variables is, that

- you can redefine (change config) and do (graceful) restart.
   This won't work for shell variables, because all children are still 
forked from the same original parent process, which hasn't changes its 

- you can use the features of the normal config files (include etc) and 
define the variables closer to were you use them.

mod_define was part of the 1.3 mod_ssl written by Ralf Engelschall. I 
ported it to 2.x and offered to include into trunk some time ago. At 
least Stefan Fritsch liked the idea :)

One minor problem: The ${xxx} syntax clashes with RewriteMap syntax.

You can find the port at

Feedback welcome.



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message