Error page and internal command

Hello,

I’m currently running nginx-0.7.62.

My conf goes like:

error_page 404 /404/
error_page 500 /500/

location = /404/ { internal; }
location = /500/ { internal; }

It works fine but if i visit mydomain.com/404/ i get the default nginx
404 page instead of my custom one. Same thing with mydomain.com/500/ .
I get the default nginx 404 page instead of my custom one.

Am i missing smth?

Thnx!

On Thu, Oct 08, 2009 at 05:56:56PM -0500, Fernando Flórez wrote:

location = /500/ { internal; }

It works fine but if i visit mydomain.com/404/ i get the default nginx
404 page instead of my custom one. Same thing with mydomain.com/500/ .
I get the default nginx 404 page instead of my custom one.

Am i missing smth?

Where are these

error_page 404 /404/;
error_page 500 /500/;

directives set ? They should be set on server level.

It is.

server {
server_name mydomain.com;

             access_log              /path/to/logs/access.log;
             error_log               /path/to/logs/error.log;

             root                    /path/to/website/htdocs;
             index                   index.html;

             error_page 403 404 /404/;
             error_page 502 503 504 /500/;

             location = /404/ { internal; }
             location = /500/ { internal; }

}

Thanks,

Hello!

On Fri, Oct 09, 2009 at 12:20:29PM -0500, Fernando Flórez wrote:

Not physically. The /404/ folder is mapped to a fastcgi process
(django url).

Your config suggest that it’s processed by nginx static module.
If the dir or file doesn’t exists - default 404 page is expected
result.

Maxim D.

On Fri, Oct 09, 2009 at 10:05:36AM -0500, Fernando Flórez wrote:

             error_page 403 404 /404/;
             error_page 502 503 504 /500/;

             location = /404/ { internal; }
             location = /500/ { internal; }

}

Does /path/to/website/htdocs/404/index.html exist ?

Not physically. The /404/ folder is mapped to a fastcgi process
(django url).

On Fri, Oct 09, 2009 at 12:20:29PM -0500, Fernando Flórez wrote:

Not physically. The /404/ folder is mapped to a fastcgi process
(django url).

So is this incomplete configuration ?
I could not reproduce the issue.

BTW, 502-504 errors should be handled by static files, since there is
big chance to get another 502/504 error while handling them using
fastcgi.

Yes, it is not complete. Sorry, i thought that was enough. Here is my
full config for “server”:

server {
server_name agenciaperu.tv;

             access_log              /path/to/logs/access.log;
             error_log               /path/to/logs/error.log;

             root                    /path/to/htdocs;
             index                   index.html;

             error_page 403 404 /404/;
             error_page 502 503 504 /500/;

             location = /404/ { internal; }
             location = /500/ { internal; }

location / {
                     fastcgi_pass    unix:/tmp/fcgi-process.sock;

                     include fastcgi_params;

                     fastcgi_param   PATH_INFO $fastcgi_script_name;
             }

}

I’ll make a change to server 50x errors with a static file.

Thanks!