主要是为了以后能举一反三
Apache配置方案
首先,安装apache的一个第三方模块“mod_rpaf”, 官方网站: http://stderr.net/apache/rpaf/
wget http://www.stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar zxvf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
/alidata/server/httpd/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
修改apache配置/alidata/server/httpd/conf/httpd.conf,在最末尾添加:
LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
RPAFsethostname On
RPAFproxy_ips ip地址
RPAFheader X-Forwarded-For
//RPAFproxy_ips ip地址(这个ip地址首先不是slb提供的公网ip,具体ip多少可以看一下apache日志,通常会有2个 都要写上)
添加完成后重启apache
/alidata/server/httpd/bin/apachectl restart
具体案例
LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 10.242.230.65 10.242.230.131
RPAFheader X-Forwarded-For
/usr/local/apache2/bin/apxs -i -A -n rewrite /lamp/httpd-2.2.9/modules/mappers/mod_rewrite.so
/usr/local/apache2/bin/apxs -i -c -n mod_rewrite.so mod_rewrite.c
linux apache 打模块示例