Storing $server_addr in a variable VS using it directly in location block

Valentin V. Bartenev vbart at nginx.com
Wed Jul 15 12:26:51 UTC 2015


On Wednesday 15 July 2015 07:45:34 itpp2012 wrote:
> Valentin V. Bartenev Wrote:
> -------------------------------------------------------
> > On Tuesday 14 July 2015 21:46:58 justink101 wrote:
> > > According to the documentation getting the value of $server_addr to
> > > set a
> > > response header makes a system call, and can impact performance
> > > negativelyset $ip $server_addr;
> 
> > No, it wouldn't.  The "set" directive also is executed on every
> > request.
> 
> Via map as well ? (geo would suffer as well then)
> 

All variables work on a per requests basis, no exceptions.

  wbr, Valentin V. Bartenev



More information about the nginx mailing list