Absolute path for error_page in nginx?

Steffan Donal picture Steffan Donal · Feb 26, 2013 · Viewed 7.6k times · Source

Is there a way I can set an absolute path for nginx error_pages? Not absolute as in http://, but absolute as in /usr/var/nginx/errors/500.html.

Answer

number5 picture number5 · Feb 26, 2013

Sure you can but in an indirect way:

error_page 500 /500.html;
location = /500.html {
       root   /usr/var/nginx/errors;
       allow all;
       internal;
}

see http://wiki.nginx.org/HttpCoreModule#error_page