error_page and named locations

cynix cynix at cynix.org
Thu Dec 11 13:09:56 MSK 2008


Igor Sysoev <is at ...> writes:

> 
> You may want to add this here:
> 
>     log_not_found   off;
> 

Yes I have that line there. Since it's not related to the problem at hand I left
it out for simplicity's sake.

> 
> The attached patch fixes the bug.
> 

Thanks Igor, the patch works as intended.

I'd also like your opinion on another way to do the same thing.

 location ~ \.php$ {
  set $script_filename $document_root$fastcgi_script_name;
  if (!-f $script_filename) {
   set $script_filename $document_root/index.php;
  }
  fastcgi_pass   127.0.0.1:1234;
  include        fastcgi_params;
  fastcgi_param  SCRIPT_FILENAME $script_filename;
 }

Is this a better way to handle requests to non-existent PHP files? This way
nginx takes care of checking if the file exists, and if it doesn't exist the
original request is not passed to FastCGI at all. Only 1 request is passed to
FastCGI, but with the addition of file existence checking. Will this yield
better performance than 2 requests to FastCGI?






More information about the nginx mailing list