linux apache 2.4 安装,linux中apache 2.4 安装 mod_rpaf教程

在使用第三方的DANginx插件用在Directadmin apache2.4的时候,发现无法安装mod_rpaf.这个插件是用来让apache获取到访客正确ip的。

apache2.4已经有了mod_remoteip.so 但没时间仔细研究,Directadmin无法正常加载,先行编译mod_rpaf达到要求

编译时提示的错误

# apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

/var/www/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic   -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/include/apache  -I/usr/include/apache   -I/usr/include/apache   -c -o mod_rpaf-2.0.lo mod_rpaf-2.0.c && touch mod_rpaf-2.0.slo

mod_rpaf-2.0.c: In function 'rpaf_cleanup':

mod_rpaf-2.0.c:150: error: 'conn_rec' has no member named 'remote_ip'

mod_rpaf-2.0.c:151: error: 'conn_rec' has no member named 'remote_addr'

mod_rpaf-2.0.c:151: warning: implicit declaration of function 'inet_addr'

mod_rpaf-2.0.c:151: error: 'conn_rec' has no member named 'remote_ip'

mod_rpaf-2.0.c: In function 'change_remote_ip':

mod_rpaf-2.0.c:164: error: 'conn_rec' has no member named 'remote_ip'

mod_rpaf-2.0.c:183: error: 'conn_rec' has no member named 'remote_ip'

mod_rpaf-2.0.c:186: error: 'conn_rec' has no member named 'remote_ip'

mod_rpaf-2.0.c:187: error: 'conn_rec' has no member named 'remote_addr'

mod_rpaf-2.0.c:187: error: 'conn_rec' has no member named 'remote_ip'

apxs:Error: Command failed with rc=65536

解决办法:

wget http://soft.dahualab.com/manage/directadmin/easyinstall/mod_rpaf-0.6.tar.gz

tar xzvf mod_rpaf-0.6.tar.gz

cd mod_rpaf-0.6

apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

mod_rpaf让apache获取访客真实IP

安装好了之后,需要对httpd.conf文件进行配置。

1、在httpd.conf加入如下代码:

1.2.RPAFenable On

3.RPAFsethostname On

4.RPAFproxy_ips 127.0.0.1

5.RPAFheader X-Forwarded-For

6.

加载模块代码:

1.LoadModule rpaf_module   modules/mod_rpaf-2.0.so

2、并定义日志格式

1.LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined

3、以后可以使用如下代码启用此格式的日志:

1.CustomLog "/home/wwwlogs/$domain.log" varnishcombined

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值