How to install mod_cloudflare using plesk, not through the extension please through ssh

hi i have my setted Cloudflare but my logs are showing Cloudflare i dig some and found that i have to install mod_Cloudflare i have tried almost every guide i can see nothing has worked till yet

server ubunto 18.4 , cpanel plesk
i dont want to use the extension plesk provide i tried tho but it just make my site down

No guarantees, as it’s been a while since I did this on my Plesk on Ubuntu 16.04 box.
dpkg -i mod_Cloudflare-xenial-amd64.latest.deb

Add the following lines to /etc/nginx/conf.d/Cloudflare.conf and then restart Nginx.

# $remote_addr rewriting in case of NGINX behind Cloudflare.
# See also mod_Cloudflare Apache module configuration.

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 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 199.27.128.0/21;

real_ip_header CF-Connecting-IP;
1 Like

already got those codes. not working

EDIT : working, i was restarting apache instead of nginx , thanks @sdayman

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.

As an update to this thread, I noticed my logs showing Cloudflare IP addresses. My Cloudflare.conf file disappeared. So I put it back and restarted NGINX. I guess a Plesk update refreshed that conf directory and spoiled my fun.