error_page and named locations

Igor Sysoev is at rambler-co.ru
Wed Dec 10 19:49:54 MSK 2008


On Wed, Dec 10, 2008 at 05:28:48PM +0100, Almir Karic wrote:

> the problem is that when you request \.php$ the error_page from locatin /
> doesn't get executed. to resolve the problem move the error_page directive out
> of the location / (directly in server {}).

No, there is a bug in nginx.

> On Wed, Dec 10, 2008 at 03:52:22PM +0000, cynix wrote:
> > cynix <cynix at ...> writes:
> > 
> > > 
> > > But if I used the following:
> > > 
> > >  location ~ \.php$ {
> > > 
> > >   error_page 404 = /index.php;
> > >  }
> > > 
> > > Then it will work as intended.
> > > 
> > 
> > Just to clarify, I meant 
> > 
> >  location ~ \.php$ {
> >   fastcgi_pass 127.0.0.1:1234;
> >   include fastcgi_params;
> >   fastcgi_param SCRIPT_FILENAME /www_root$fastcgi_script_name;
> >   fastcgi_param SCRIPT_NAME $fastcgi_script_name;
> >   fastcgi_intercept_errors on; 
> >   error_page 404 = /index.php;
> >  }
> > 
> > works. I used "..." instead of retyping the whole thing to save a few keystrokes
> > but don't know why it didn't show.
> > 
> > 

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





More information about the nginx mailing list