Error_page
語(yǔ)法: error_page code [code …] [=\=answer-code] uri
默認值:no
Context:http,server,location
URI指定了為特定的錯誤碼顯示的頁(yè)面
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服務(wù)器處理的話(huà)就可返回不同的錯誤應答碼
error_page 404 = /404.php;index
語(yǔ)法:index file [file…]
默認值:index.html index
Context:http,server,location
指定索引文件,在文件名中可以使用變量,檢測順序由列舉出的文件順序決定,可以將一個(gè)含有絕對路徑的文件放到最后
使用變量的例子
index index.$geo.html index.0.html /index.html;internal
語(yǔ)法:internal
默認值:no
Context:location
此指令使得匹配location僅僅為稱(chēng)為“internal”的request所使用,如果是外部請求則返回“not found”的錯誤。
內部請求包括
阻止client直接獲得error_page的例子
Error_page 404 /404.html
Location /404.html {
Internal;
}
聯(lián)系客服