安装部署
安装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
安装 NaiveProxy
navie proxy 属于 caddy 的插件
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
~/go/bin/xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive
添加配置文件
编辑配置文件: vim /etc/caddy.json
将下列json内容添加至 /etc/caddy.json
中,并修改
{
"admin": {
"disabled": true
},
"logging": {
"sink": {
"writer": {
"output": "discard"
}
},
"logs": {
"default": {
"writer": {
"output": "discard"
}
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"auth_pass_deprecated": "<你的密码>",
"auth_user_deprecated": "<你的用户名>",
"handler": "forward_proxy",
"hide_ip": true,
"hide_via": true,
"probe_resistance": {}
}
]
},
{
"match": [
{
"host": [
"你的域名"
]
}
],
"handle": [
{
"handler": "file_server",
"root": "<你的伪装网站目录>",
"index_names": [
"index.html"
]
}
],
"terminal": true
}
]
}
]
}
],
"tls_connection_policies": [
{
"match": {
"sni": [
"<你的域名>"
]
}
}
],
"automatic_https": {
"disable": true
}
}
}
},
"tls": {
"certificates": {
"load_files": [
{
"certificate": "<你的SSL证书路径>",
"key": "<你的SSL证书路径>"
}
]
}
}
}
}
使用 Pm2 运行 Caddy
pm2 start ./caddy -n caddy -- run --config /etc/caddy.json
评论区