Passing variables to access_log, error_log names

Richard Kearsley Richard.Kearsley at
Sun Feb 27 00:55:15 MSK 2011

Where are you setting $project?

Richard Kearsley

-----Original Message-----
From: ajgon [mailto:nginx-forum at] 
Sent: 26 February 2011 21:50
To: nginx at
Subject: Passing variables to access_log, error_log names


I am configuring an automagic virtual hosting on my private machine, to
serve myself projects which I currently work on. Configuration I'm using
is like this:

server {
  listen 80;
  server_name ~^(www\.)?(?P[^.]+)$;
  root /home/ajgon/htdocs/$project;
  access_log /var/log/nginx/$ main;
  error_log /var/log/nginx/$ info;
  include lang/php;

Everything is working as expected - except one thing. I'm getting two
log files with following names:
for any Vhost.

Is there any sollution to make nginx parse the variable and set proper
log name?

Greets from Poland and thank you for any help!

Posted at Nginx Forum:,178665,178665#msg-178665

nginx mailing list
nginx at

More information about the nginx mailing list