Welcome! Log In Create A New Profile

Advanced

Re: multiple error_pages in one directory - with one location - not possible?

Maxim Dounin
July 31, 2011 09:16AM
Hello!

On Sun, Jul 31, 2011 at 02:53:45PM +0200, Sven 'Darkman' Michels wrote:

[...]

> and put a page named "status-503.html" intoo the statuspages dir. This
> works so far. But i would like to keep the locations as less as possible.
> So i tried the following:
>
> error_page 503 /status/503.html;
> error_page 403 /status/403.html;
> location = /status {
> root /var/www/statuspages;
> }
>
> But surprise, surprise, it didn't work. I got a 404 error. Of course i
> have renamed the status-xxx.html pages to xxx.html, too. I also tried it

Path to file is produced as <root> + <uri>. In your case <uri> is
"/status/503.html", so expected file path is
"/var/www/statuspages/status/503.html". Do you actually have this
file?

From what you wrote it looks like you instead have
"/var/www/statuspages/503.html" file. Using "alias" directive
instead of "root" should resolve your problem.

See here for more information:

http://wiki.nginx.org/HttpCoreModule#root
http://wiki.nginx.org/HttpCoreModule#alias

Note well: nginx should log error to error_log if it isn't able to
find requested file; looking into error_log is always a good idea.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

multiple error_pages in one directory - with one location - not possible?

Sven 'Darkman' Michels July 31, 2011 08:58AM

Re: multiple error_pages in one directory - with one location - not possible?

Maxim Dounin July 31, 2011 09:16AM

Re: multiple error_pages in one directory - with one location - not possible?

Sven 'Darkman' Michels July 31, 2011 09:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 217
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready