Menu

江苏Apache日志获取阿里云CDN真实IP

网站建设 录入时间 2023-05-10 阅读次数 次 无双建站
打开apache配置apache/conf/httpd.conf文件,找到大概276行

添加%{X-FORWARDED-FOR}i

Apache日志配置文件中定义了两种打印格式,分别为combined格式和common格式。

本人使用combined格式

image.png

    #

    # The following directives define some format nicknames for use with

    # a CustomLog directive (see below).

    #

    LogFormat "%h ClinetIp:%{X-FORWARDED-FOR}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

    LogFormat "%h %l %u %t \"%r\" %>s %b %{X-FORWARDED-FOR}i" common

   

      # 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

   

    #

    # The location and format of the access logfile (Common Logfile Format).

    # If you do not define any access logfiles within a

    # container, they will be logged here.  Contrariwise, if you *do*

    # define per- access logfiles, transactions will be

    # logged therein and *not* in this file.

    #

    CustomLog "logs/access_log" common

    #

    # If you prefer a logfile with access, agent, and referer information

    # (Combined Logfile Format) you can use the following directive.

    #

    #CustomLog "logs/access_log" combined

保存重启Apache即可

【版权声明】:本站内容来自于与互联网(注明原创稿件除外),供访客免费学习需要。如文章或图像侵犯到您的权益,请及时告知,我们第一时间删除处理!谢谢!

无双科技
如何获取外贸询盘和订单?
网站建设咨询:13534259410

经典客户案例展示

热门服务
众多企业的选择

深圳无双科技 - 专注于高端网站建设、网站设计开发、品牌网站制作

咨询电话:13534259410

售后服务:13534259410  (7×24小时)
在线 Q Q:253849310 (售前咨询)

深圳网站建设咨询
【扫一扫咨询】
  • 扫一扫 在线咨询
    无双科技官方公众号
  • 响应式客户端
    扫一扫 关注好友
体验创新服务

深圳无双科技,专注于深圳网站建设、深圳网站设计、深圳网站制作。
服务客户超3000家,一站式网站建设及推广营销解决方案提供商。
我们的价值观:诚信、坦诚、尽责、创新。期待与您合作!

您好,很高兴为您服务 ^_^