nginx

1 关于location的写法

syntax: location [=|~|~*|^~] /uri/ { … }

 

 

2多个location执行顺序

 

 

The order you established in the configuration file (placing the /files/ block before 

the = /files/ block) is irrelevant. Nginx will search for matching patterns in a 

specific order:

1.  location blocks with the = modifier: If the specified string exactly matches 

the requested URI, Nginx retains the location block

2.  location blocks with no modifier: If the specified string exactly matches the 

requested URI, Nginx retains the location block

3.  location blocks with the ^~ modifier: If the specified string matches the 

beginning of the requested URI, Nginx retains the location block

4.  location blocks with ~ or ~* modifier: If the regular expression matches the 

requested URI, Nginx retains the location block

5.  location blocks with no modifier: If the specified string matches the 

beginning of the requested URI, Nginx retains the location block

In that extent, the ^~ modifier begins to make sense, and we can envision cases 

where it becomes useful.

 

 

参考文档:

1 book - Nignx http server    chapter: Location --search order and priority

http://blog.rackcorp.com/?p=31  

http://flandycheng.blog.51cto.com/855176/280121

 

上面2,3链接,都是延伸,有助于在1的基础上,基于实例,更深的了解。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值