Added on May 31st, 2012 and marked as config nginx server varnish web

Since nginx is running behind Varnish, the log files will show the IP address 127.0.0.1 as the address where the request is coming from. To log the real IP address, you can add the following lines to the nginx configuraton file:

set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;

nginx will then start logging the correct IP address rather than 127.0.0.1.

In order to use real_ip_header it is important to have HttpRealipModule installed.n (Use nginx -V to get a list of all configured modules.)