使用Haproxy时apache日志的配置方法
2014-04-04 10:57
465 查看
使用Haproxy时apache日志的配置方法
在使用haproxy作反向代理时,apache日志配置中%h抓取的是haproxy主机Ip,而非用户Ip地址,如果想让apache记录用户ip,只需把%h改成{X-Forwarded-For}i 即可后端apache日志处理
配置httpd.conf
<IfModule log_config_module> # # Thefollowing directives define some format nicknames for usewith # aCustomLog directive (see below). # #LogFormat"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"\"%{User-Agent}i\"" combined LogFormat"%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b\"%{Referer}i\" \"%{User-Agent}i\"" combined #LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat"%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b"common <IfModule logio_module> # You need to enable mod_logio.c to use %I and %O #LogFormat "%h %l %u %t \"%r\" %>s %b\"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s%b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule>........
其它的不变,保存后重启apache
相关文章推荐
- Eclipse使用Maven创建Web时错误:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webap
- PHP5+APACHE2.2配置
- apache设置mpm_winnt_module模块
- Apache中设置可以访问根目录,禁止访问子目录的方法
- 总结使用Apache作为WebLogic集群代理
- 微软在Apache许可证下开源WinJS
- CentOS 6.2编译安装Apache2.4.1+MySQL5.5.21+PHP5.3.10
- 微信公众开放平台开发05---jetty部署异常:rg.apache.jasper.JasperException: PWC6345: There is an error in invoking ja
- 解决apache服务器本地可以访问,同局域网内他人不能访问的问题(转)
- 【Maven】org.apache.tiles.startup.basictilesinitializer 找不到
- Apache Karaf Overview 特性 了解
- win server 2003+apache+php 开启openssl
- Apache开启伪静态
- java.lang.ClassNotFoundException: org.apache.hadoop.hbase.mapreduce.TableOutputFormat解决办法
- apache ab传递参数
- 如何让apache支持URL重写
- Apache性能优化、超时设置,linux 重启apache
- apache如何开启gzip为VPS加速
- 安装php5.4 mv9 +apache2.2+mysql5.5问题好多。
- apache重写规则详解