Question

Cloudflare - any solution for "Logging Real Visitor IP Addresses" with nginx and vesta?

Posted January 25, 2015 8k views

hi,

I just wonder if there is any solution for: nginx and vesta panel?

In the original post: https://www.cloudflare.com/resources-downloads (“Logging Real Visitor IP Addresses: mod_cloudflare for Apache httpd”) only talks about a solution for “Apache” and “cpanel”.

thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

3 answers

Just add the following lines to your nginx.conf inside http block

set_real_ip_from 204.93.240.0/24;
set_real_ip_from 204.93.177.0/24;
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
real_ip_header CF-Connecting-IP;

Here is a tutorial, not that hard, just edit main Nginx conf file /etc/nginx/nginx.conf

add the lines to the http { } section of your config file.

Submit an Answer