variable substitution issue

Stephane Bunel stephane+nginx at bpf.st
Sat Aug 2 14:16:19 MSD 2008


Hi (sorry for my bad english),

   I just installed nginx for evaluation purpose on Gentoo GNU/Linux

#nginx -V
nginx version: nginx/0.7.6
configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf 
--http-log-path=/var/log/nginx/access_log 
--error-log-path=/var/log/nginx/error_log --pid-path=/var/run/nginx.pid 
--http-client-body-temp-path=/var/tmp/nginx/client 
--http-proxy-temp-path=/var/tmp/nginx/proxy 
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-md5-asm 
--with-md5=/usr/include --with-sha1-asm --with-sha1=/usr/include 
--with-http_realip_module --with-http_flv_module --with-http_ssl_module

   My typical configuration file (included into main config) for a vhost 
is as follow:

server {
     listen      wiki.MySite.tld:80 ;
     server_name wiki.MySite.tld ;

     set         $localpath                 /home/www/MySite.tld/wiki ;
     set         $localroot                 $localpath/htdocs ;

     access_log  $localpath/access.log main ;

     rewrite     ^/_media/(.*)              /lib/exe/fetch.php?media=$1 
last;
     rewrite     ^/_detail/(.*)             /lib/exe/detail.php?media=$1 
last;
     rewrite     ^/_export/([^/]+)/(.*)     /doku.php?do=export_$1&id=$2 
last;

     location / {
         index index.php index.html ;
         root  $localroot ;
         if (!-f $request_filename) {
             rewrite ^/(.*)?(.*)            /doku.php?id=$1&$2 last;
             rewrite ^/$                    /doku.php last;
         }
     }

     location ~ \.php$ {
         include         /etc/nginx/php-fastcgi.conf ;
         fastcgi_index   index.php ;
         fastcgi_param   SCRIPT_FILENAME $localroot$fastcgi_script_name ;
     }
}

   I encounter issue with access_log path (and error_log too but nginx 
complains) wich seems not correctly computed. The result should be 
"/home/www/MySite.tld/wiki/access.log". Nnginx prepend "/usr/" before 
$localpath. Strace is my spy:


open("/usr//home/www/MySite.tld/wiki/access.log", 
O_RDWR|O_CREAT|O_APPEND|O_LARGEFILE, 0644) = -1 ENOENT (No such file or 
directory)

Is my usage of "set" directive wrong ? Otherwise it seems to work 
correctly with others ones.

Thx for your help.

Stephane.





More information about the nginx mailing list