2 个回答

在实际情况中,一般我们的服务可能通过的LVS转发,因此这里我们需要使用http_x_forwarded_for来进行限制,例如:
set $allow false;
if ($http_x_forwarded_for = "211.144.204.2") { set $allow true; }
if ($http_x_forwarded_for ~ "108.2.66.[89]") { set $allow true; }
if ($allow = false) { return 404; }
发布于:2个月前 (01-11)

添加白名单的配置如下:
location /admin/ {
allow 192.168.1.0/24;
deny all;
}
上边表示只允许192.168.1.0/24网段的主机访问,拒绝其他所有
发布于:2个月前 (01-11)
我来回答
您需要 登录 后回答此问题!