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

cloudflare-page-rules

CloudFlare Page Rules for WordPress

Here are CloudFlare page rules for WordPress web site.

yourdomain/xmlrpc.php*

yourdomain/wp-login.php*

yourdomain/wp-admin/*

CloudFlare Page Rules for WordPress

yourdomain/wp-content/uploads/*