Archive

Archive for May, 2010

How to log the user IP, not the proxy, in varnish access log

May 9th, 2010 admin No comments

varnish-logo-red-64After long search, I managed to bring up issues with varnish+apache logs (real ip instead of 127.0.0.1). Here’s what it is:

First, install mod_rpaf from here.

cd /usr/local/src

wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz

tar xzf mod_rpaf-0.6.tar.gz

cd mod_rpaf-0.6

Compiling rpaf module:

nano /usr/local/src/mod_rpaf-0.6/makefile

Change APXS=$(shell which apxs) to APXS=/usr/sbin/apxs.

Compile ways:

I)

make rpaf-2.0 && make install-2.0

II)

apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

Next you must do following:

mcedit /etc/httpd/conf/httpd.conf

Add following lines:

LoadModule rpaf_module modules/mod_rpaf-2.0.so

#Mod_rpaf settings
RPAFenable On
RPAFproxy_ips 127.0.0.1 REALIP1 REALIP2

RPAFsethostname On

That’s it!

Don’t forget to run service httpd restart! :)

Cheers

Categories: Headline, Tutorials Tags: