Administrators Leon Posted August 16, 2012 Administrators Share Posted August 16, 2012 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. Solution: # Install rpaf module for Apache2 aptitude install libapache2-mod-rpaf # Enable it a2enmod rpaf Now add this to your apache.conf or httpd.conf RPAFenable On RPAFsethostname On RPAFproxy_ips 127.0.0.1 10.0.0.1 RPAFheader X-Forwarded-For # 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; Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now