nginx 0.8.47 php-fpm error_page not working

Igor Sysoev igor at sysoev.ru
Sun Aug 8 10:51:46 MSD 2010


On Sun, Aug 08, 2010 at 02:36:57AM -0400, nginx_newbie wrote:

> Dear Nginx Experts / Friends,
> 
> I am new to nginx. Just getting my feet wet since around 15 days.
> I am sorry for this extremely long post. Just wanted to give all
> details
> for quick understanding of the problem hence long code attachments.
> 
> I have installed CentOS 5.5 + nginx + php-fpm on linode.com VPS.
> Default error_page 404 in nginx.conf for server localhost is working.
> 
> But for domain name based configuration [1] error_page is not working.
> I disabled php-fpm to see if that is the problem, but still I do not see
> the error404.htm
> page. I am also attaching my nginx.conf [2], fastcgi_params [3] &
> php-fpm.conf [4] for reference.
> I even did a debug [5] but could not find any problem from the same. 
> 
> Attachment One [/etc/nginx/sites-enabled/mutually4u.com]
> ---------------------------------------------------------------------------------------------------------------------------------
> server {
>         listen 80;
>         server_name www.mutually4u.com mutually4u.com;
>         access_log /srv/www/mutually4u.com/logs/access.log;
>         error_log /srv/www/mutually4u.com/logs/error.log debug;
> 
> 	error_page 404 /error404.htm;
> 
> 	location /error404.htm {
> 		root /srv/www/mutually4u.com/public_html;
> 	}
> 
>         location = /favicon.ico {
>             #empty_gif;
>             return 204;
>         }
> 
>         location / {
>                 root   /srv/www/mutually4u.com/public_html;
>                 index index.htm;

This directive:

>                 if (-f $request_filename) {
>                         break;
>                 }

is useless.

>         }
> 
>         location ~ \.htm$
>         {
>                 root   /srv/www/mutually4u.com/public_html;
>                 fastcgi_pass 127.0.0.1:9000;
>                 fastcgi_param SCRIPT_FILENAME
> /srv/www/mutually4u.com/public_html$fastcgi_script_name;
>                 fastcgi_param PATH_INFO $fastcgi_script_name;

You need to add here
                  fastcgi_intercapt_errors on;

>                 include /etc/nginx/fastcgi_params;
>         }
> 
> }

[ ... ]

> I tried all combinations of error_page in / out of the location setting
> before and after the
> fast_cgi options etc.. Even disabling gzip and fastcgi settings but even
> with a plain nginx
> and separate mutually4u.com server config file, i am not able to see the
> redirect error404.htm
> page on the browser. Directly accessing the error404.htm page works
> fine. I am using the
> server version nginx/0.8.47 as seen in the debug output along with php
> 5.2.14 with APC and
> memcache enabled. Even after spending more than 8 hours with various
> options I am clueless.
> I also googled a lot of code to find the cause of this problem and also
> searched this forum,
> but could not find the cause of this simple problem.


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



More information about the nginx mailing list