Replacing rpaf module with remoteip
Replacing rpaf module with remoteip
I've had a small niggling problem for a few months, but haven't got around to fixing it until now. In the default apache+nginx installation for Ubuntu, the module libapache2-mod-rpaf is installed. This works OK up to a point: it logs the correct remote IP in the server logs in /var/log/apache2/domains/. However the apache traffic report at https://your.server.address:8083/list/server/?web shows the incorrect IP address: that of the server itself.
[If you can't find this, its
Dashboard > Server > SHOW CPU/NET/MEM/DISK > Web
I used VestaCP for around a year before I discovered this section! ]
So it seems the way to fix this is to replace rpaf with remoteip. Here are the steps:
nano /etc/apache2/mods-available/remoteip.conf
and add these lines replacing the IP address with the IP address of your server.
Now swap the modules over, but don't restart apache yet.
Now open up /etc/apache2/apache2.conf and alter the Logfile format. Find these lines
and change the %h at the beginning of each one to %a
Test:
Restart apache
Check the logfiles to make sure the correct IP addresses are appearing. And then check the apache status page.
https://your.server.address:8083/list/server/?web
[If you can't find this, its
Dashboard > Server > SHOW CPU/NET/MEM/DISK > Web
I used VestaCP for around a year before I discovered this section! ]
So it seems the way to fix this is to replace rpaf with remoteip. Here are the steps:
nano /etc/apache2/mods-available/remoteip.conf
and add these lines replacing the IP address with the IP address of your server.
Code: Select all
<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 22.33.44.55
</IfModule>
Code: Select all
a2dismod rpaf
a2enmod remoteip
Code: Select all
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
Code: Select all
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%a %l %u %t \"%r\" %>s %O" common
Code: Select all
apachectl -t
Code: Select all
systemctl restart apache2.service
https://your.server.address:8083/list/server/?web