第一次提交:脚本部署naive代理
parent
45febc938d
commit
b95f4f85ab
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
# Naive setup
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local:~/bin
|
||||
export PATH
|
||||
|
||||
# 安装 GO 升级时直接运行会覆盖
|
||||
wget "https://go.dev/dl/$(curl https://go.dev/VERSION?m=text).linux-amd64.tar.gz" && tar -xf go*.linux-amd64.tar.gz -C /usr/local/
|
||||
echo 'export GOROOT=/usr/local/go' >> /etc/profile
|
||||
echo 'export PATH=$GOROOT/bin:$PATH' >> /etc/profile
|
||||
source /etc/profile
|
||||
echo $(go version) && rm go*.linux-amd64.tar.gz
|
||||
|
||||
# 编译安装caddy+naive
|
||||
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest && \
|
||||
~/go/bin/xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive
|
||||
|
||||
chmod +x caddy
|
||||
cp caddy /usr/bin/
|
||||
echo $(/usr/bin/caddy version) && rm -r go
|
||||
setcap cap_net_bind_service=+ep /usr/bin/caddy
|
||||
|
||||
# 添加配置文件
|
||||
mkdir /etc/caddy/
|
||||
cat > /etc/caddy/Caddyfile <<EOF
|
||||
:443, vn.ahfei.icu # 只用改这一个
|
||||
tls vgamebox@outlook.com # 你的邮箱
|
||||
route {
|
||||
forward_proxy {
|
||||
basic_auth Devalue t3NL5&vD*5RgG7 #用户名和密码
|
||||
hide_ip
|
||||
hide_via
|
||||
probe_resistance
|
||||
}
|
||||
forward_proxy {
|
||||
basic_auth dude A112358.. #用户名和密码
|
||||
hide_ip
|
||||
hide_via
|
||||
probe_resistance
|
||||
}
|
||||
reverse_proxy https://nextcloud.ahfei.blog { #伪装网址
|
||||
header_up Host {upstream_hostport}
|
||||
header_up X-Forwarded-Host {host}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# 前台运行
|
||||
caddy fmt --overwrite /etc/caddy/Caddyfile
|
||||
caddy run --config /etc/caddy/Caddyfile
|
Loading…
Reference in New Issue