nginx1->nginx2->apache and wrong IP address in nginx2 access log

Piotr Gasidło quaker at
Sun Jun 7 16:44:25 MSD 2009

2009/6/6  <mates007 at>:
> Hello,
> I have a machine 1 with nginx as a proxy before apache, and machine2 with nginx as a proxy before apache. I am moving websites from machine1 to machine2. Because DNS still points to machine1, I need to pass traffic from machone1 to machine2 for a while.
> Everything is working fine, but in machine2 nginx log I have IP of machine1 as clients address. This is a problem because of awstats.
> Can please anybody advise me that I have wrong in my configuration?

Have a look at and
configure it on machine2:

set_real_ip_from   outgoing_ip_address_of_machine1;
real_ip_header     X-Real-IP;

Piotr Gasidło

More information about the nginx mailing list