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

maybe i'm to stupid or missing something, but actually i try to setup a set
of custom error_pages. To keep it simple, i put them all into one directory
and named them like the error i want to catch with them.

From the examples, i found setups like this:
error_page 404 /404.html;
error_page 502 503 504 /50x.html;

but since i don't want them to be in the root of my virtual host, i put
them into a different directory (outside of root). For that reason, i
created a config like this:
error_page 503 /status-503.html;
error_page 403 /status-403.html;
location = /status-503.html {
root /var/www/statuspages;
}
location = /status-403.html {
root /var/www/statuspages;
}

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
with ^~ /status/, = /status/ and things like error_page 503 @status/503.html
and location @status - with no success.

At the end i would like to have some internal location or something like that
to avoid conflicts with real existing directorys - if possible. And just one
location for my error pages.

Is that possible at all or should i just use multiple locations and everything
is fine...?

Thanks and regards,
Sven

_______________________________________________
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: 106
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready