2eew 发表于 2016-1-18 10:22:57

haproxy后端nginx取得用户访问ip地址

         set_real_ip_from 172.16.100.120;#haproxy 的IP地址
      set_real_ip_from 172.16.100.110;#haproxy 的IP地址
      real_ip_header X-Forwarded-For;

      log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
                        '$status $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';

nginx配置文件设置如上

后端nginx服务可以取得用户访问的真实ip地址。

页: [1]
查看完整版本: haproxy后端nginx取得用户访问ip地址