如何修改节点里的主控域名
节点连接主控时默认使用主控 IP 直连。如果主控前面套了 CDN / 中转,或主控绑定了域名并校验 Host 头,需要给节点配置"主控域名",节点请求主控时会携带该域名作为 Host 头。
在每台需要修改的 V6 节点上使用 root 执行以下命令。把 www.example.com 改成自己的主控域名:
bash -s <<'CDNFLY_SET_MASTER_HOST'
master_host="www.example.com"
set -euo pipefail
conf="/opt/cdnfly-go/agent/conf/config.yaml"
test -f "$conf"
grep -q '^master:$' "$conf"
cp -a "$conf" "$conf.$(date +%Y%m%d%H%M%S).bak"
sed -i "/^master:/,/^[^[:space:]]/ s|^\([[:space:]]*\)host:.*|\1host: \"$master_host\"|" "$conf"
systemctl restart agent-socket.service agent-task.service
systemctl is-active agent-socket.service agent-task.service
CDNFLY_SET_MASTER_HOST
命令会自动备份原配置(同目录生成带时间戳的 .bak 文件),并重启节点服务生效。
取消主控域名
把 host 改回空即可:
sed -i "/^master:/,/^[^[:space:]]/ s|^\([[:space:]]*\)host:.*|\1host: \"\"|" /opt/cdnfly-go/agent/conf/config.yaml
systemctl restart agent-socket.service agent-task.service
检查结果
grep -A3 '^master:' /opt/cdnfly-go/agent/conf/config.yaml
确认 host 已改为新域名,且主控后台中节点保持在线。