how to get the real visitor ip for cloudflare users in nginx

getting the real visitor ip for cloudflare users in nginx is easy: 1) add a new config file like so: sudo nano /etc/nginx/conf.d/cloudflare.conf # CloudFlare # IPv4 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; […]

how to setup nginx as a reverse proxy

Setting up a reverse proxy using nginx is easy: for this how-to i will use debian 1) install nginx: sudo apt-get install nginx 2) remove the default config (or move somewhere else for reference): sudo rm /etc/nginx/sites-enabled/default sudo rm /etc/nginx/sites-available/default 3) copy your certificates to the machine or generate some if using self-signed certificates, for […]