apache2.2 做后端,增加真实ip到日志中

apache2.2使用mod_remoteip模块

一.安装

wget https://github.com/ttkzw/mod_remoteip-httpd22/raw/master/mod_remoteip.c

/usr/local/apache/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c

二.添加Apache配置

vi /usr/local/apache/conf/httpd.conf

Include conf/extra/httpd-remoteip.conf

vi /usr/local/apache/conf/extra/httpd-remoteip.conf

LoadModule remoteip_module modules/mod_remoteip.so

RemoteIPHeader X-Forwarded-For

RemoteIPInternalProxy 127.0.0.1 #多个前端代理,请用空格分隔