回答

14

当然,你可以,但以间接的方式:

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

看到http://wiki.nginx.org/HttpCoreModule#error_page

+3

请注意,这不会里面'http'块工作。 – 2015-05-28 02:28:17

+0

@magu [官方文档](http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page)表示它也可以在'http'上下文中使用。你使用的是什么版本的nginx? – number5 2015-05-28 04:56:45

+4

'error_page'起作用。 '位置'不。 – 2015-05-30 06:00:04