Not existant files passed to php backend

Igor Sysoev is at rambler-co.ru
Wed Aug 20 19:34:32 MSD 2008


On Wed, Aug 20, 2008 at 05:29:00PM +0200, Roxis wrote:

> On Wednesday 20 August 2008, Reinis Rozitis wrote:
> > > it is expected
> > >
> > > if you don't like php's 404 page
> > > set fastcgi_intercept_errors to on
> >
> > I see.
> >
> > Just switching from lighty where the default behaviour is first to check
> > the local file ( lighttpd has an extra setting 'check-local' where you can
> > specify to look for the file on local disk rather than blindly forwarding
> > to request on the fastcgi backend )
> >
> > Although this is handy in case of remote fastcgi backends isnt the majority
> > setups where the nginx and php (and other fastcgi processes) are on the
> > same box? And as the php is the slowest component wouldnt it be more
> > efficient from the performance point of view for the nginx throw the error
> > first rather than intercepting the error later (and maybe add a
> > setting/feature (mimic to lighty) to disable the local file check)..
> >
> > Anyways thx for the hint.
> >
> > rr
> 
> you can use ngx_http_rewrite_module
> 
> if (!-f $request_filename) {
>     return 404;
> }
> fastcgi_pass ...
> 
> but it's not recommended

Although I generally do not recommend to use "if (!-f $request_filename)",
it's mostly related to complex directive inside "if" block, something like:

      if (!-f $request_filename) {
          fastcgi_pass ...
      }

but simple "return 404" in "if" block is OK.


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





More information about the nginx mailing list