Created
October 22, 2024 07:46
-
-
Save takinbo/9e9cb4cdde239756d5f5bfe0bcb82913 to your computer and use it in GitHub Desktop.
script for generating the snippet to include in the nginx configuration file for using the real ip address when logging access.
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
#!/usr/bin/env bash | |
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 X-Forwarded-For;" | |
echo "real_ip_recursive on;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment