Page 1 of 1

Real IP with/through NGINX reverse proxy

Posted: Mon Sep 08, 2014 3:01 pm
by injeckt
Hi there. I've been using VestaCP since not long ago and have found that neither the forum or CMS register the real IP of my visitors.

I wonder how to register the real IP of my visitors and not the IP of the server itself (the same with NGINX reverse proxy and Apache).

I have installed version 0.9.8-10 of VestaCP on Ubuntu Server 14.04 LTS 64-bits

Thank you very much in advance. A greeting.

Re: Real IP with/through NGINX reverse proxy

Posted: Wed Sep 10, 2014 5:19 pm
by rhonk
I found a guide that may be useful. http://thejoyofstick.com/blog/2013/04/1 ... ind-nginx/

Re: Real IP with/through NGINX reverse proxy

Posted: Thu Sep 11, 2014 10:42 am
by injeckt
rhonk wrote:I found a guide that may be useful. http://thejoyofstick.com/blog/2013/04/1 ... ind-nginx/
Yes, I have tried to do just that, but I see is configured in VestaCP by default, but I dont know because it doesn't works correctly. I dont know if it is a bug or some kind of problem I have VestaCP. I have installed VestaCP on several servers and they all give me the same problem (without change configurations).

I still dont know how to fix it or what might be wrong.

Re: Real IP with/through NGINX reverse proxy

Posted: Sat Nov 22, 2014 7:33 pm
by injeckt
I still have the same problem. The only solution I've found, example for WordPress, is adding:

Code: Select all

if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
  $_SERVER['REMOTE_ADDR'] = $ips[0];
}
in a functions.php file. Is there any solution to this? I still do not know because it shows me the IP reverse proxy and not the IP of the user connecting to the web.