Apache 服务中order allow/deny 范围公式

Order A, B   (其中,A和B均可以代表allow或者deny,以下conlist表示控制列表)
A from conlist1
B from conlist2

那么最终访问控制的结果为:(以(A)表示A的控制范围,)
(A)= (conlist1) U (!conlist2)  (!--取反,U--并集, n--交集)
(B)= (!A) = (!conlist1) n (conlist2)
(A)+(B)= I(全集)

下面有一个图简单表示了allow与deny的范围关系:

比如:
Order allow,deny
Allow from 192.168.10.0
Deny from 192.168.10.1

(Allow)= 192.168.10.0网段中除192.168.10.1之外的IP地址。
(Deny)= 192.168.10.1+192.168.10.0网段之外的IP地址。

注意:

1)
Order后面allow和deny的顺序与下面Allow from和Deny from的顺序无直接关系。最终求得的范围是根据Order那一行的顺序来写的。即:上面例子的结果等同于:
Order allow,deny
Deny from 192.168.10.1
Allow from 192.168.10.0

2)如果在order之后并没有定义具体的allow或deny的访问控制列表,则默认以后者为准。

下面是Apache官方文档有关order的说明:

The Order directive controls the default access state and the order in which Allow and Deny directives are evaluated. Ordering is one of

Deny,Allow
The Deny directives are evaluated before the Allow directives. Access is allowed by default. Any client which does not match a Deny directive or does match an Allow directive will be allowed access to the server.
Allow,Deny
The Allow directives are evaluated before the Deny directives. Access is denied by default. Any client which does not match an Allow directive or does match a Deny directive will be denied access to the server.
Mutual-failure
Only those hosts which appear on the Allow list and do not appear on the Deny list are granted access. This ordering has the same effect as Order Allow,Deny and is deprecated in favor of that configuration.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值