Variable substition inconsistency

Maxim Dounin mdounin at
Thu Jul 12 21:16:24 UTC 2012


On Thu, Jul 12, 2012 at 05:05:24PM -0400, mondalaci wrote:

> Hi List,
> Here's a section of my configuration:
> set $site;
> root /var/www/$site;
> server_name $site;
> access_log /var/log/nginx/${site}_access.log;
> error_log /var/log/nginx/${site}_error.log;
> In this example root and access_log gets substituted, server_name and
> error_log doesn't.  Where can I look up that in which contexts
> substitution works?

If variables are supported, it's explicitly documented:

Note well: the above config snippet suggests you don't need 
variables, but need some configuration macros instead.  Variables 
are evaluated at run time for each request and it's bad idea to 
use them just to replace several static strings.  Use your 
favorite macro processor instead if you need to.

Maxim Dounin

More information about the nginx mailing list