If you run nginx behind a CDN, you will by default see the proxy/CDNIPinstead of the real client.
Edit the global http { part of nginx.conf and add this:
# 1. Specify the IP address of your trusted proxy/load balancer
set_real_ip_from 1.2.3.4;
set_real_ip_from 5.2.3.4;
# 2. Specify which header contains the real client IP
real_ip_header X-Forwarded-For;........