docs(deploy): document PV/UV stats and real client IP via nginx realip
This commit is contained in:
1 parent
b215f8eb09
commit
ff5e05998a
11 files changed
+308
-6
No files matched your search
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# 生成 Cloudflare 节点网段清单,供 realip-cloudflare.conf 使用。
|
||||
#
|
||||
# 用法: sudo bash deploy/nginx/update-cloudflare-ips.sh [输出文件]
|
||||
# 默认输出: /etc/nginx/cloudflare-ips.conf
|
||||
set -euo pipefail
|
||||
|
||||
OUT="${1:-/etc/nginx/cloudflare-ips.conf}"
|
||||
|
||||
{
|
||||
for url in https://www.cloudflare.com/ips-v4 https://www.cloudflare.com/ips-v6; do
|
||||
curl -fsSL "$url" | sed '/^[[:space:]]*$/d; s/^/set_real_ip_from /; s/$/;/'
|
||||
done
|
||||
} > "${OUT}.tmp"
|
||||
|
||||
mv "${OUT}.tmp" "$OUT"
|
||||
echo "已写入 $OUT"
|
||||
|
||||
if command -v nginx >/dev/null 2>&1; then
|
||||
nginx -t && nginx -s reload
|
||||
fi
|
||||
Reference in new issue
Block a user