1)修改haproxy配置文件,添加如下参数:
option httpcloseoption forwardfor
2)修改nginx配置文件,添加如下参数 注意:需要编译模块--with-http_realip_module
#haproxy服务器IPset_real_ip_from 192.168.64.128;real_ip_header X-Forwarded-For;real_ip_recursive on;
3)分别重启haproxy和nginx
/etc/init.d/haproxy restart/etc/init.d/nginx restart
本文出自 “命运.” 博客,请务必保留此出处http://hypocritical.blog.51cto.com/3388028/1675267