Nginx and Apache2 are running great but there is only one tiny problem with the visitors ip’s.
Normaly I let my nginx instance do the logging job, but if you let your Apache do it you will get some problems. Apache will see all incoming requests as coming from localhost (127.0.0.1). Right they are all from nginx.
# Install rpaf module for Apache2 aptitude install libapache2-mod-rpaf # Enable it a2enmod rpaf # Restart apache2 /etc/init.d/apache2 restart
This tells Nginx to forward the original remote IP-address in the header as it proxys ro Apache.
Add this 3 Lines to your nginx.conf or to your enables site config:
proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;