set variables within config

Michael Shadle mike503 at
Fri May 15 01:14:51 MSD 2009

yeah i have a script to build some configs already. but to match
production i have to pull out the common stuff and put it into .conf
files, and then set $var something; include foo.conf; so that the
configs match on dev and production but the dynamic pieces are filled
in appropriately per user/environment.

On Thu, May 14, 2009 at 2:01 PM, Cliff Wells <cliff at> wrote:
> On Thu, 2009-05-14 at 13:39 -0700, Michael Shadle wrote:
>> On Thu, May 14, 2009 at 12:32 PM, Maxim Dounin <mdounin at> wrote:
>> > As of now nginx has no variables expanded during config loading -
>> > everything expaneded during request processing.  So using
>> > variables just to save some config lines is somewhat stupid as it
>> > means wasting lots of CPU time for every request.
>> >
>> > If you really need to simplify configs - it's easy to generate
>> > them using make and sed.
>> This might be what Igor meant by "configuration macros"?
> If you wanted, you could probably even leverage some template engine
> (typically used for HTML generation, but often useful standalone) to
> generate configs.
> Cliff

More information about the nginx mailing list