打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Nginxhttp模块(三)
userphoto

2009.07.24

关注

Error_page

语法: error_page code [code …] [=\=answer-code] uri

默认值:no

Contexthttpserverlocation

URI指定了为特定的错误码显示的页面

e.g.

error_page    404           /404.html;
error_page    502 503 504  /50x.html;
error_page    403           http://example.com/forbidden.html;

Furthermore, it is possible to change the code of answer to another, for example:

error_page 404 =200 /.empty.gif;

If an erroneous answer is processed by the proxied or FastCGI server and this server can return the different answer codes, for example, 200, 302, 401 or 404, then it is possible to issue the code returned:

若错误应答由代理或fastCGI服务器处理的话就可返回不同的错误应答码

error_page    404  =  /404.php;

index

语法:index file [file…]

默认值:index.html index

Contexthttpserverlocation

指定索引文件,在文件名中可以使用变量,检测顺序由列举出的文件顺序决定,可以将一个含有绝对路径的文件放到最后

使用变量的例子

index  index.$geo.html  index.0.html  /index.html;

internal

语法:internal

默认值:no

Contextlocation

此指令使得匹配location仅仅为称为“internal”的request所使用,如果是外部请求则返回“not found”的错误。

内部请求包括

  • requests redirected by the instruction error_page :由error_page重定向的请求
  • subrequests created by the command include virtual of the "ngx_http_ssi_module" module ngx_http_ssi_moduleinclude virtual命令所产生的子请求
  • requests changed by the instruction rewrite of the "ngx_http_rewrite_module" module ngx_http_rewrite_modulerewrite命令修改的请求。

阻止client直接获得error_page的例子

Error_page 404 /404.html

Location /404.html {

              Internal;

}

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
ngingx安装错误 ./configure: error: the HTTP rewrite module requires the PCRE library.
nginx源代码分析_浪湾(langwan) 一个思想跳跃的程序员
nginx + lua 限制ip地址访问
Nginx实战系列之功能篇
nginx限制连接数ngx
【Nginx18】Nginx学习:WebDav文件存储与图片媒体处理模块
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服