-f $request_filename

Igor Sysoev igor at sysoev.ru
Mon Apr 19 21:17:29 MSD 2010


On Mon, Apr 19, 2010 at 05:25:12PM +0200, Tomasz Pajor wrote:

> 
> > Hello
> >> Got something like this, but the break seams to not work,
> >> and the file is being processed by the php fastcgi process.
> >>
> >> Any clue why?
> >>
> >> location / {
> >>      if (-f $request_filename) {
> >>        root /vhosts/default/test;
> >>        break;
> >>      }
> >>
> >>      try_files $uri $uri/ @fallback;
> >>      fastcgi_pass unix:/var/run/spawn-fcgi.sock;
> >>      
> > Wow.  I wonder what you are trying to achieve...
> >    
> When requesting http://domain.tld/sitemap.xml the request should
> got to the fastcgi process, because that needs to be generated from 
> application.
> 
> But when requesting other xml files it should use the files;

A generic method:

location / {
    root /vhosts/default/test;
    try_files $uri $uri/ @fallback;
}

location @fallback {
    fastcgi_pass unix:/var/run/spawn-fcgi.sock;
    ...
}

Or always pass XML to fastcgi:

location / {
    root /vhosts/default/test;
}

location ~ \.xml$ {
    fastcgi_pass unix:/var/run/spawn-fcgi.sock;
    ...
}


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list