Apache 2.4 安裝 mod_evasive

在 Apache 2.4 編譯 mod_evasive 時遇到以下錯誤:

mod_evasive20.c: In function ‘access_checker’:
mod_evasive20.c:142: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:146: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:158: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:165: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:180: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:187: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:208: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:212: warning: implicit declaration of function ‘getpid’
mod_evasive20.c:215: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:221: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:222: error: ‘conn_rec’ has no member named ‘remote_ip’
mod_evasive20.c:228: error: ‘conn_rec’ has no member named ‘remote_ip’
apxs:Error: Command failed with rc=65536

在 Google 找了一下,原因出在 Apache 2.4 的 remote_ip 改名為 client_ip,要成功安裝,可以將 mod_evasive20.c 內的 remote_ip 字串改為 client_ip,方法如下:

cp mod_evasive20.c mod_evasive24.c
sed s/remote_ip/client_ip/g -i mod_evasive24.c

然後用 apxs 編譯新的 mod_evasive24.c:

apxs -i -a -c mod_evasive24.c




Latest Comments

  1. xqiushi 17 July 2017

Leave a Reply