Blocking IP's Nginx behind proxy
- by FunkyChicken
I'm running a Nginx 1.2.4 webserver here, and I'm behind a proxy of my hoster to prevent ddos attacks. The downside of being behind this proxy is that I need to get the REAL IP information from an extra header. In PHP it works great by doing $_SERVER[HTTP_X_REAL_IP] for example.
Now before I was behind this proxy of my hoster I had a very effective way of blocking certain IP's by doing this: include /etc/nginx/block.conf and to allow/deny IP's there.
But now due to the proxy, Nginx sees all traffic coming from 1 IP.
Is there a way I can get Nginx to read the IP's like how PHP does, with the X-REAL-IP header?