一:nginx.conf
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
其实这个proxy.conf里面默认都有,在nginx.conf使用include proxy.conf就可以
二:apache第三方的mod
主页:http://stderr.net/apache/rpaf/
下载:http://stderr.net/apache/rpaf/download/
安装:
1 2 3 4 5 | # wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz 下载 # tar zxvf mod_rpaf-0.6.tar.gz 解压 # cd mod_rpaf-0.6 #/usr/local/apache2/bin/apxs -i -a -c mod_rpaf.c Apache 1.3.x 的安装方式 #/usr/local/apache2/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c Apache 2.x 的安装方式 |
httpd.conf配置:
1 2 3 4 5 | LoadModule rpaf_module modules /mod_rpaf-2 .0.so RPAFenable On RPAFsethostname On RPAFproxy_ips 127.0.0.1 # 填写Nginx的来访IP RPAFheader X-Forwarded-For |
转载于:https://blog.51cto.com/skypeng/715715