Linux 4 All

Best Linux tricks source

In a previous post I was explaining how to log visitor real IP address in access_log. Now it’s time to do the same for error_log.

For this we are going to compile and install a module called mod_vgremoteip

Steps outlined bellow:

1. Get the module

git clone https://github.com/vgno/mod_vgremoteip.git

2. Install gcc and httpd-devel tools
yum install httpd-devel
yum install gcc

3. Compile the module
apxs -a -i -c mod_vgremoteip.c

4. Configure Apache to use it
LoadModule vgremoteip_module  modules/mod_vgremoteip.so

# Name of header which contains the 'real' client IP.
 VGRemoteIPHeader X-Forwarded-For
# Subnet to mark as trusted subnet (this ip will be allowed to set the X-Forwarded-For header and marked as a proxy ip).
# You should specify this.
VGTrustedProxy 10.0.0.0/8
# You can also specify a single ip addresses.
# Do not specify hostnames.
VGTrustedProxy 127.0.0.1

5. Restart Apache and you are done.
service httpd restart

How to test IMAP POP3 and SMTP authentication from command line arrow-right
Next post

arrow-left Get mail queue
Previous post

Leave a Reply

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