用于$HTTP["remoteip"]
此检查:
$HTTP["remoteip"]
在远程 IP 或远程网络上匹配(警告:不适用于启用 IPv6)
然后你的配置文件:
$HTTP["host"] =~ "(^|\.)example\.com$" {
#### for live system
$HTTP["remoteip"] == "10.10.10.10" {
server.document-root = "/var/www/example.com/http"
}
#### for requests from ip xxx
$HTTP["remoteip"] == "11.11.11.11" {
server.document-root = "/var/www/example.com/testing/http"
}
}
您还可以使用else
:
$HTTP["host"] =~ "(^|\.)example\.com$" {
#### for requests from ip xxx
$HTTP["remoteip"] == "11.11.11.11" {
server.document-root = "/var/www/example.com/testing/http"
}
#### for live system
else {
server.document-root = "/var/www/example.com/http"
}
}