【问题标题】:mod_evasive not working in Apache 2.4.48 on Ubuntu 18.04mod_evasive 在 Ubuntu 18.04 上的 Apache 2.4.48 中不起作用
【发布时间】:2021-09-17 02:16:43
【问题描述】:

我按照https://www.atlantic.net/vps-hosting/how-to-install-and-configure-modevasive-with-apache-on-ubuntu-18-04/ 中的说明安装了 mod_evasive,但配置如下:

    DOSHashTableSize    3097
    DOSPageCount        1
    DOSSiteCount        10
    DOSPageInterval     1
    DOSSiteInterval     1
    DOSBlockingPeriod   10

但是当我运行 perl 脚本时,我没有看到 IP 被列入黑名单,所有请求都得到响应 200 ok,而我期待 403 Forbidden :(

我做错了什么??

其他详细信息:当我重新启动 Apache 时,我看到了 6 个实例。当我运行测试 perl 脚本时,立即检查 apache 实例的数量,我会看到 30 个实例的数量,然后在一段时间后降至 10 个。

我的 Apache 配置如下所示:

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

我的 mpm_prefork_module 配置如下所示:

StartServers             5
MinSpareServers          5
MaxSpareServers          10
MaxRequestWorkers        80
MaxConnectionsPerChild   1

这是 Apache 配置的问题吗??

【问题讨论】:

    标签: apache2.4 mod-evasive


    【解决方案1】:

    问题不在于 mod_evasive 或其配置本身。

    在我的情况下,我必须像下面这样调整 mpm_prefork_module 的配置才能使 mod_evasive 配置起作用:

    StartServers             10
    MinSpareServers          10
    MaxSpareServers          10
    MaxRequestWorkers        80
    MaxConnectionsPerChild   0
    

    基本上通过设置StartServers = MinSpareServers = MaxSpareServers = {your_magic_number}和设置MaxConnectionsPerChild=0将服务器的数量固定为常数,这样就不会产生新的服务器进程,也不会发生连接的重新循环,从而允许Child持有无限多的并发连接。

    我在修复这个问题上浪费了一天的时间,希望这个答案有公式,你不会浪费你的一天:)

    【讨论】:

      猜你喜欢
      • 2018-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多