Variables in access_log

miradev nginx-forum at
Fri Jul 3 17:28:11 MSD 2009


The log file path can contain variables (version >=0.7.4) ..

 nginx -v
nginx version: nginx/0.7.59

Config snippet:

  set $client $host;
  if ($client ~ "^(*)"){
    set $client $1;
  root /var/www/wordpress/$client/admin;

  location / {
    access_log /var/log/nginx/wordpress/admin/$client/generic-access.log;
    error_log /var/log/nginx/wordpress/admin/$client/generic-error.log;

Fails on test:

nginx -t
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
: open() "/var/log/nginx/wordpress/admin/$client/generic-error.log" failed (2: No such file or directory)
configuration file /usr/local/nginx/conf/nginx.conf test failed

Have I misunderstood?

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

More information about the nginx mailing list