Page 2 of 2

Re: Solution to obtain the source IP address. REMOTE_ADDR

Posted: Fri Sep 02, 2016 8:54 pm
by dpeca
Works perfectly od Debian 8.5.

Re: Solution to obtain the source IP address. REMOTE_ADDR

Posted: Sat May 27, 2017 3:49 pm
by maxplay
dsystem wrote:I tried all the tips in this topic cited. But it didn't work.

I found out that apache 2.4 has the remoteip native and the rpaf is no longer supported.

I'll put here changes in Ubuntu 14.04.1

Remove rpaf that doesn't work.
# apt-get remove libapache2-mod-rpaf

create the file remoteip.conf
# nano /etc/apache2/mods-available/remoteip.conf

Code: Select all

<IfModule mod_remoteip.c>
RemoteIPHeader X-Real-IP
RemoteIPInternalProxy 127.0.0.1
RemoteIPInternalProxy xxx.xxx.185.66 // server ip
</IfModule>
Activate remoteip which is native in Apache 2.4
a2enmod remoteip
service apache2 restart

Now works perfectly...
thanks!
All my config was working, after installing mod security some extra modules were installed also i beleive that broke my previous config.... so my config stopped working...and i didn't see my remote IP as before

then, finally i just disable module rpaf: sudo a2dismod rpaf

And it worked again as before

EDIT: in vestacp, in the accesslog of the domain, the ip of the server was registered, not the client public ip address, so i follow this step:

Change the Log Format (%h -> %a)
#sudo vi /etc/apache2/apache2.conf

Before: LogFormat “%h %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” combined
After: LogFormat “%a %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” combined

tip from: http://www.olivershanahan.com/?p=35

thanks for your post