$server_name in error_log logfile name

Maxim Dounin mdounin at mdounin.ru
Wed Sep 21 13:31:50 UTC 2011


Hello!

On Wed, Sep 21, 2011 at 08:39:42AM -0400, Hety wrote:

> I'm currently trying to make a template for future virtual hosts. To
> minimize the amount of editing required i am using $server_name in some
> parts of the template.
> 
> For example:
> server_name example.com
> access_log  /var/log/www/$server_name-access  combined;
> error_log   /var/log/www/$server_name-error   error;
> 
> While it works great for access_log directive(logfile is named
> example.com-access), error log file name is, actually
> $server_name-error. 
> I'm running nginx 1.0.6

The "error_log" directive doesn't support variables.

Addtionally, this is not intended use of variables.  They are 
run-time and evaluated for each request.  You want to use some 
config generator instead.

Maxim Dounin



More information about the nginx mailing list