Possible bug in "root" declaration?

Systems Maintenance systems at goballistic.co.uk
Thu May 28 17:51:11 MSD 2009

Below is part of a server block for a particular vhost:

server {
    server_name mysite.tld ~^.+\.mysite\.tld$;

    set $base /var/www/mysite;

    if ( $host ~* "^(x|y|z)\.mysite\.tld$" ){
       set $files misc;

    if ( $host ~* "^(admin)\.mysite\.tld$" ){
       set $files admin;

    if ( $host = "mysite.tld" ){
       set $files home;

    root $base/$files/www;
    error_page 404 $base/errors/404.html;

    location / {
       try_files $uri @webapp;

    location @webapp {
       rewrite ^/([\w\d]+)/([\w\d]+)(.*)? /index.php/$1/$2?_params=$3 last;

    location ~ \.php($|/) {
        set $script $uri;
        set $path_info "";

        if ($uri ~ "^(.+\.php)(/.+)") {
            set $script $1;
            set $path_info $2;

        fastcgi_pass unix:/tmp/php-socket;
        include conf/fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_param SCRIPT_FILENAME $base/$interface$script;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_index index.php;


What I'm seeing in my error log is that the error_page its trying to 
return is: /var/www/mysite/var/www/mysite/errors/404.html instead of the 
expected /var/www/mysite/errors/404.html

I've also tried (with no success):

error_page 404 @notfound;
location @notfound {
    root $base/errors;
    error_page 404 404.html;
    index 404.html;

Here's my version information, if it helps:

# nginx -V
nginx version: nginx/0.7.55
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-44)
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx 
--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid 
--with-rtsig_module --with-select_module --with-poll_module 
--with-http_ssl_module --with-http_stub_status_module 
--with-http_gzip_static_module --with-http_flv_module 
--http-log-path=/var/log/nginx/access.log --with-md5=/usr/lib 
--with-sha1=/usr/lib --without-mail_pop3_module 
--without-mail_imap_module --without-mail_smtp_module 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090528/198f837f/attachment.html>

More information about the nginx mailing list