首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

Nginx include授命的测试

2012-07-22 
Nginx include指令的测试需求:淘宝的Tengine服务器在1.0.1版本的时候对Include指令进行了增强:?location~

Nginx include指令的测试

需求:

淘宝的Tengine服务器在1.0.1版本的时候对Include指令进行了增强:

?

location ~ /er.* { error_page 404 /404_1.html; } location ~ /err.* { error_page 404 /404_2.html; }

?

?访问url: http://serverip:port/error/pageNotExit;

?返回: 404_1.html页面;

?

?访问url: http://serverip:port/eroor/pageNotExit;

?返回: 404_1.html页面;

?

案例二:

当配置文件内的location配置如下时:

?

        location ~ /err.* {            error_page 404 /404_2.html;        }        location  ~ /er.* {            error_page 404 /404_1.html;        }

?访问url: http://serverip:port/error/pageNotExit;

?

?返回: 404_2.html页面;

?

?访问url: http://serverip:port/eroor/pageNotExit;

?返回: 404_1.html页面;

?

因此,我们只需要在将这两个location配置写如不同的文件中:

?

server { listen 8099; server_name localhost; include location/*.conf;}?

那么通过设计特定的url访问并检查返回结果就可以测试include指令对多个文件的包含顺序了。

?

ok, ?Nginx include指令的测试介绍完毕, 欢迎拍砖。转发请备注转自:100continue.iteye.com。 谢谢。

热点排行