I have a server on which NGinx is installed.
Now the problem is that visitors ip is shown as my server ip please guide what to do in this regard?
Hello,
Opencart uses
to retrieve the IP of the visitor.
However, when using Nginx, it is normal that it is returning the machine IP using the above code.
SOLUTION
Edit your nginx.conf file which is normally located on '/etc/nginx' and add the following line:
You will need to reload Nginx.
Then go to 'catalog/controller/common/footer.php' and replace the line below:
with
Hope it helps you.
Opencart uses
Code: Select all
$this->request->server['REMOTE_ADDR'];
However, when using Nginx, it is normal that it is returning the machine IP using the above code.
SOLUTION
Edit your nginx.conf file which is normally located on '/etc/nginx' and add the following line:
Code: Select all
proxy_set_header X-Real-IP $remote_addr;
Then go to 'catalog/controller/common/footer.php' and replace the line below:
Code: Select all
$ip = $this->request->server['REMOTE_ADDR'];
Code: Select all
$ip = $this->request->server['HTTP_X_REAL_IP'];
Hope it helps you.
Thank you for your reply the hosting people has resolved this problem by themselves any ways very helpful to get this reply.
Who is online
Users browsing this forum: Semrush [Bot] and 21 guests