Archive for March 1, 2020

apache 2.4 Version get real ip

apache 2.4 version has been added by default mod_remoteip ,Check the configuration if found not resolve deleted,please delete#.

1.The following added to the apache configuration in the rearmost:

RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1/24
#CloudFlare IP Ranges
RemoteIPInternalProxy 103.21.244.0/22
RemoteIPInternalProxy 103.22.200.0/22
RemoteIPInternalProxy 103.31.4.0/22
RemoteIPInternalProxy 104.16.0.0/12
RemoteIPInternalProxy 108.162.192.0/18
RemoteIPInternalProxy 131.0.72.0/22
RemoteIPInternalProxy 141.101.64.0/18
RemoteIPInternalProxy 162.158.0.0/15
RemoteIPInternalProxy 172.64.0.0/13
RemoteIPInternalProxy 173.245.48.0/20
RemoteIPInternalProxy 188.114.96.0/20
RemoteIPInternalProxy 190.93.240.0/20
RemoteIPInternalProxy 197.234.240.0/22
RemoteIPInternalProxy 198.41.128.0/17 #CDN of your IP,Can be repeated to add

2.Modify the configuration information below

  1. #Modify log format,Plus the log format%a,Then you can restart apache:
  2. LogFormat “%h %a %l %u %t ”%r” %>s %b ”%{Referer}i” \”%{User-Agent}i”” combined
  3. LogFormat “%h %a %l %u %t ”%r” %>s %b ” common
  4. LogFormat “%h %l %u %t \”%r” %>s %b ”%{Referer}i” \”%{User-Agent}i” %I% O” combined

Comments off