项目

通用

个人资料

操作

限制连接

模块: mod_evasive

描述

已弃用 mod_evasive 应该被替换为 lua mod_evasive

mod_evasive 是一个非常简单的模块,用于限制每个 IP 的连接数。

选项

evasive.max-conns-per-ip

限制每个 IP 的连接数。

evasive.max-conns-per-ip = 3

您可能还需要设置条件

    evasive.max-conns-per-ip = 1

    $HTTP["host"] == "example.com" {
      evasive.max-conns-per-ip = 2
    }
    $HTTP["host"] == "example2.com" {
      evasive.max-conns-per-ip = 0
    }

0 表示无限制。
在这种情况下,默认站点获得 1 个连接,example.com 获得 2 个,example2.com 无限制。

evasive.silent

如果启用,则不在 error.log 中记录被阻止的 IP。

evasive.silent = "enable" 

evasive.location (自 1.4.40 起)

如果超出连接限制且 evasive.location 已配置,则返回 302 Found (临时重定向) 并在 Location 头中指定 evasive.location,而不是返回 403 Forbidden。
evasive.location = "http://external.site/busy.html" 必须是位于不同服务器上的外部站点,否则会导致重定向循环。

更新于 gstrauss 大约 3 年前 · 18 次修订