Custom error_page basic config problem.

Agus agus.262 at
Mon Jan 14 22:02:41 UTC 2013

Hi fellows,

I was having trouble creating a custom error_page. Here's the simple test
config i did:


error_log logs/ debug;
access_log logs/ main;

root /usr/local/www/www.test1;

    location / {
# Esto es para simular el geoip con un if.
if ( $remote_addr = "" ) {
error_page 401 /custom/404b.html;
return 401;

With that, i only got the nginx default error page. After turning on debug
i saw that when nginx goes to fetch the error_page mentioned it searches in
location / so it denies and send me the default error. Now i added a
location like this

    location = /custom/404b.html {

Which made it work.

My question is is this is OK. If my solution is the correct one or perhaps
theres a better one. Also, this test is easy cause its local, but i want to
implemtn this in a proxy_pass situation. Probably the intercept_error..

Thanks for any hints you can give.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list