nginx中error_page的绝对路径?

Posted

技术标签:

【中文标题】nginx中error_page的绝对路径?【英文标题】:Absolute path for error_page in nginx? 【发布时间】:2013-02-11 06:13:53 【问题描述】:

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

【问题讨论】:

【参考方案1】:

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

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

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

【讨论】:

@magu official docs 表示它也适用于 http 上下文。你用的是什么版本的nginx?

以上是关于nginx中error_page的绝对路径?的主要内容,如果未能解决你的问题,请参考以下文章