mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-11 19:56:37 +08:00
更新 proxy.sh
This commit is contained in:
@@ -78,22 +78,24 @@ else
|
|||||||
echo "⚠️ 未检测到IPv6支持,将使用IPv4监听"
|
echo "⚠️ 未检测到IPv6支持,将使用IPv4监听"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ===== 安装Caddy及DNS插件 =====
|
# ===== 安装Caddy =====
|
||||||
if ! command -v caddy &>/dev/null; then
|
if ! command -v caddy &>/dev/null; then
|
||||||
echo "🔧 安装Caddy及DNS插件..."
|
echo "🔧 安装Caddy..."
|
||||||
apt update && apt install -y debian-keyring debian-archive-keyring apt-transport-https curl unzip
|
apt update && apt install -y curl unzip
|
||||||
|
|
||||||
# 安装 xcaddy
|
# 使用官方安装脚本
|
||||||
curl -sSfL https://raw.githubusercontent.com/caddyserver/xcaddy/master/install.sh | bash
|
curl -sSfL https://caddyserver.com/static/install.sh | bash -s
|
||||||
|
|
||||||
# 根据选择编译 Caddy
|
# 或者使用包管理器安装(取消注释以下行)
|
||||||
dns_plugins=""
|
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||||
[[ "$dns_provider" == "cloudflare" ]] && dns_plugins+=",github.com/caddy-dns/cloudflare"
|
# curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
|
||||||
[[ "$dns_provider" == "dnspod" ]] && dns_plugins+=",github.com/caddy-dns/dnspod"
|
# apt update
|
||||||
[[ "$dns_provider" == "alidns" ]] && dns_plugins+=",github.com/caddy-dns/alidns"
|
# apt install caddy
|
||||||
|
|
||||||
xcaddy build latest --with github.com/caddyserver/caddy/v2$dns_plugins
|
# 确保caddy在正确位置
|
||||||
mv caddy /usr/local/bin/caddy
|
if [[ -f "/usr/bin/caddy" ]]; then
|
||||||
|
mv /usr/bin/caddy /usr/local/bin/caddy
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p /etc/caddy
|
mkdir -p /etc/caddy
|
||||||
@@ -180,7 +182,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ===== 重启Caddy =====
|
# ===== 重启Caddy =====
|
||||||
systemctl daemon-reexec
|
systemctl daemon-reload
|
||||||
systemctl enable caddy
|
systemctl enable caddy
|
||||||
systemctl restart caddy
|
systemctl restart caddy
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user