nginx中error_page的绝对路径?

Ste*_*nal 9 configuration webserver nginx absolute-path custom-error-pages

有没有办法为nginx error_pages设置绝对路径?不是绝对的http://,而是绝对的/usr/var/nginx/errors/500.html.

num*_*er5 16

当然,你可以间接地:

error_page 500 /500.html;
location = /500.html {
       root   /usr/var/nginx/errors;
       allow all;
       internal;
}
Run Code Online (Sandbox Code Playgroud)

请参阅http://wiki.nginx.org/HttpCoreModule#error_page

  • `error_page`有效.`location`没有. (5认同)
  • 请注意,这在`http`块内不起作用. (4认同)