假设我想限制对虚拟主机的访问多种的IP 范围。如何实现?Perl 正则表达式语法样式不起作用,而且我不希望有像 *10.** 这样的宽松限制
下面的代码适用于单个范围:
$HTTP["host"] == "adm.example.org" {
$HTTP["remoteip"] != "10.0.0.0/28" {
url.access-deny = ( "" )
}
}
提前致谢。
答案1
$HTTP["remoteip"] !~ "192.168.2\.|192.168.0\.|^10.8.9\." {
url.access-deny = ( "" )
}
or to include for the 192.168.0.0 network only this range: 192.168.0.180 - 192.168.0.188
$HTTP["remoteip"] !~ "192.168.2\.|192.168.0.18[0-8]|^10.8.9\." {
url.access-deny = ( "" )
}
答案2
$HTTP["host"] == "adm.example.org" {
$HTTP["remoteip"] != "1.2.3.4|5.6.7.8|9.10.11.12" {
url.access-deny = ( "" )
}
}
等等