Skip to content

Instantly share code, notes, and snippets.

@minetaro12
Created January 6, 2022 10:04
Show Gist options
  • Save minetaro12/c8e9183fb1b1507fda8cf79b7f7da75d to your computer and use it in GitHub Desktop.
Save minetaro12/c8e9183fb1b1507fda8cf79b7f7da75d to your computer and use it in GitHub Desktop.
NginxのCloudflare使用時元のIPアドレスに戻すための設定ファイル作成スクリプト
#!/bin/bash
touch cloudflare.conf
curl https://www.cloudflare.com/ips-v4 | awk 1 > cloudflare.conf
curl https://www.cloudflare.com/ips-v6 | awk 1 >> cloudflare.conf
sed -i "s/^/set_real_ip_from /" cloudflare.conf
sed -i "s/$/;/" cloudflare.conf
echo "real_ip_header CF-Connecting-IP;" >> cloudflare.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment