本文介绍两种自建代理方式:Gost 和 Hysteria。适合不想使用一键脚本、想了解底层配置的读者。
前置条件
- 拥有已解析的域名
- 服务器开放所需端口
- 已准备 TLS 证书(可参考《获取 TLS 证书指南》)
Gost
下载与安装
前往 Releases 页面 获取最新版。
1 2 3 4
| wget https://github.com/ginuerzh/gost/releases/download/v2.11.4/gost-linux-amd64-2.11.4.gz gzip -d gost-linux-amd64-2.11.4.gz mv gost-linux-amd64-2.11.4 gost chmod +x gost
|
HTTPS 代理
1 2 3 4 5
| sudo nohup ./gost -L=https://username:password@:443?probe_resist=code:404\?cert=/path/to/your/cert/file\&key=/path/to/your/key/file &
./gost -L=socks://:1080 -F=https://username:password@example.com:443
|
Clash 配置示例:
1 2 3 4 5 6 7
| - name: "Name" server: example.com port: 443 type: http username: "username" password: "password" tls: true
|
WSS 代理
1 2 3 4 5
| sudo nohup ./gost -L=mwss://username:password@:443?cert=/path/to/your/cert/file\&key=/path/to/your/key/file &
./gost -L=socks://:1080 -F=mwss://username:password@example.com:443
|
CloudFlare CDN 配置
- SSL/TLS → Overview:选择 Full
- DNS:将记录设置为 Proxied
Hysteria
下载与安装
(待补充)
服务端配置
1 2 3 4 5 6 7 8
| { "listen": ":YourPort", "cert": "/path/to/your/cert", "key": "/path/to/your/key", "obfs": "YourPassword", "up_mbps": 100, "down_mbps": 100 }
|
客户端配置
1 2 3 4 5 6 7 8 9
| { "server": "your.domain.com:YourPort", "obfs": "YourPassword", "up_mbps": 50, "down_mbps": 100, "socks5": { "listen": "YourLocalSocks5Port" } }
|
CloudFlare CDN 配置
- SSL/TLS → Overview:选择 Full
- DNS:将记录设置为 Proxied
常见问题
Q: 端口被阻断?
- 检查服务器防火墙是否放行对应端口
- 部分云服务商(如阿里云、AWS)需要在安全组中开放端口
Q: CloudFlare CDN 不生效?
- 确保 DNS 记录状态为 “Proxied”(橙色云)
- SSL 模式设为 “Full”
(待补充更多 FAQ)