Nginx CloudFlare restore real ip

When using Nginx Behind Cloudflare, logs and web applications show cloudflare sever IP instead of visitor IP.

To fix this, edit

Inside “http” section, add

You can get updated list of CloudFlare IPs from

https://www.cloudflare.com/ips/

Restart Nginx with

Example Nginx Config

https://gist.github.com/serverok/fef5c76bf96f8e016bf64095da4a64dc

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *