Categories
Tutorial

How to get visitor ip on cPanel NGINX Reverse Proxy with PHP

If you are using cPanel NGINX Reverse Proxy setup you may notice PHP $_SERVER['REMOTE_ADDR'] is returning server main IP address instead of visitor IP address.

To get visitor IP address use $_SERVER['HTTP_X_REAL_IP']

Source: https://stackoverflow.com/questions/44145688/remote-addr-ip-from-user-instead-of-nginx-reverse-proxy-server