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

Sven 'Darkman' Michels sven at
Sun Jul 31 13:43:41 UTC 2011


Am 31.07.2011 15:15, schrieb Maxim Dounin:
> 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.

Yeah, you're right :/ My fault. Didn't think about because i copied it
from another block i use, but since there is only one status page,
the setup was slightly different and worked.

> 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.

Well, i did that. But it only logs directory index of "/var/www/webroot/" is
forbidden" - nothing about the missing error page. But i got a 404 in the
accesslog, but i thought this was due to the fact that the location didn't work.

Anyway, changeing root to alias and location ^~ /status/ { internal;
alias /var/www/statuspages/; } did the trick.

Thanks a lot for the enlightenment ;)

Best regards,

More information about the nginx mailing list