AWS

Aws ELB apache remote ip

It’s always a good pratice to log remote connections on your web server, if your apache web server is setted behind an AWS ELB, you can log remote ip by modifying apache main config file /etc/apache2/apache2.conf: we replace the %h by %{X-Forwarded-For}i, this header is supported by Amazon AWS.

LogFormat "%v:%p %{X-Forwarded-For}i %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined
LogFormat "%{X-Forwarded-For}i %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t "%r" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

Leave a Reply

Your email address will not be published. Required fields are marked *