Last active
October 5, 2016 20:00
-
-
Save halkeye/71f6da042081c29259ce to your computer and use it in GitHub Desktop.
Pull cloudflare ips for nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cat /etc/nginx/conf.d/cloudflare.conf | |
# sh cloudflare_ips_nginx.sh > /etc/nginx/conf.d/cloudflare.conf && service nginx configtest && service nginx reload | |
echo "# Cloudflare" | |
for ip in $(curl -s https://www.cloudflare.com/ips-v4); do | |
echo "set_real_ip_from $ip;" | |
done | |
for ip in $(curl -s https://www.cloudflare.com/ips-v6); do | |
echo "set_real_ip_from $ip;" | |
done | |
echo "real_ip_header CF-Connecting-IP;" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment