Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

下载 caddy2

去 caddy 官方 github 下载对应的 caddy2 最新可执行文件 https://github.com/caddyserver/caddy/releases,并移动到 /usr/bin/ 下

创建 Caddyfile 配置文件,内容如下:

{
	experimental_http3
}
yourdomain.com {
	root * /var/www/html
	file_server
	encode zstd gzip
	tls /root/.acme.sh/yourdomain.com/fullchain.cer /root/.acme.sh/yourdomain.com/yourdomain.com.key

	route /zh-CN* {
		uri strip_prefix /zh-CN
		reverse_proxy localhost:10808
	}
}

由于是我原来用的就是ss + v2ray-plugin 的形式,所以这里 caddy tls 我直接使用原来 acme 脚本申请的 cf 证书;并且还开启 http3 (因为目前 v2ray-core 的 quic 还没更新到 http3, 也就说目前还没有支持 http3 代理的本地客户端, 所以这里纯粹只是让网站的访问看起来高大上!)

ss 服务器端配置, 去掉 tls,因为 tls 交给了 caddy 去完成

{
  "server": "0.0.0.0",
  "nameserver": "1.1.1.1",
  "server_port": 10808,
  "password": "password",
  "method": "chacha20-ietf-poly1305",
  "timeout": 400,
  "no_delay": true,
  "reuse_port": true,
  "workers": 1, 
  "mode": "tcp_and_udp",
  "plugin": "/usr/bin/v2ray-plugin",
  "plugin_opts": "server;fast-open;host=yourdomian.xom;loglevel=none"
}

ss 客户端

tls;path=zh-CN;host=yourdomain.com;fast-open

运行 caddy

caddy start --config /root/Caddyfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.