How to install mod_rpaf Varnish WordPress Ubuntu

And the geekiest title of the week goes to me…

Add this line to your varnish VCL in sub_recv:

set req.http.X-Forwarded-For = client.ip;

Grab mod_rpaf:

wget http://ftp.debian.org/debian/pool/main/liba/libapache2-mod-rpaf/libapache2-mod-rpaf_0.6-7_amd64.deb

Install mod_rpaf

dpkg -i libapache2-mod-rpaf_0.6-1_amd64.deb

Enable mod_rpaf:

a2enmod rpaf

Your rpaf config (/etc/apache2/mods-enabled/rpaf.conf) should look awesome like this:

<IfModule mod_rpaf.c>
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 123.123.123.123 10.0.0.2 127.0.0.1
RPAFheader HTTP_X_FORWARDED_FOR
</IfModule>

Note: RPAFproxy_ips is the ips of your varnish cache servers. Varnish is awesome.

Reload varnish and Apache the cool way.

/etc/init.d/varnish reload
/etc/init.d/apache reload

Test it by looking at your remote_addr variable:

print_r($_SERVER);

Leave a Reply

Your email address will not be published.