nginx + Varnish and IP logging
I've got varnish in front of nginx and everything is working perfectly.
One problem - all IP's in my access logs are 127.0.0.1
I've configured varnish to pass the client IP via a http header:
sub vcl_recv {
# Add a unique header containing the client address
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
I see that nginx has a RealIP module but it's not enabled by default (crazy).
The problem I have is that I've installed nginx via apt-get rather than compiling from source.
Do I need to remove nginx and reinstall from source or is there a way to enable real ip from the apt-get packaged version?
1 Reply
For Ubuntu, you can give the 'official' nginx PPA a try:
the nginx-full and nginx-extras packages include the RealIP module. I'd rather evaluate this PPA's packages instead of compiling from source, esp. if you don't have any specific needs.