在如今的网络环境下,老旧的协议(如 Shadowsocks、VMess 等)很容易被防火墙(GFW)根据流量特征识别阻断。
而 VLESS-Reality 因为其独特的“借用真实 TLS 1.3 握手证书”的设计,消除了自签 SSL 证书的特征漏洞,成为了目前抗封锁能力极强的前沿协议。本篇文章教你如何使用 Sing-box 作为服务端核心在海外 VPS 上部署它。
[!NOTE] 📌 核心速览(TL;DR / 快问快答):
- 核心协议:VLESS + Reality(传输层为 TCP,借用公网合规域名如
images.apple.com)。- 流控规范:Sing-box 服务端与客户端流控必须指定为
"flow": "xtls-r-flow"。- 部署推荐:优先采用 Docker Compose +
network_mode: host部署,兼顾安全性与超高转发吞吐。
🛠️ 第一步:环境准备与 Docker 安装
你需要拥有一台海外云主机(VPS)并拥有一台主流 Linux 操作系统(推荐 Debian 12 或 Ubuntu 24.04)。
通过 SSH 登录 VPS 终端并快速安装 Docker 运行环境:
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
🛠️ 第二步:编写 Sing-box 服务端 config.json
在 VPS 宿主机创建配置目录 /etc/sing-box/:
mkdir -p /etc/sing-box
cd /etc/sing-box
创建服务端配置文件 config.json:
{
"log": {
"level": "info",
"timestamp": true
},
"inbounds": [
{
"type": "vless",
"tag": "vless-reality-in",
"listen": "::",
"listen_port": 443,
"users": [
{
"uuid": "your-uuid-here", // 填入随机生成的 UUID
"flow": "xtls-r-flow" // 2026 正确流控规范
}
],
"tls": {
"enabled": true,
"server_name": "images.apple.com", // 借用的伪装域名
"reality": {
"enabled": true,
"handshake": {
"server": "images.apple.com", // 握手目标回源地址
"server_port": 443
},
"private_key": "your-private-key-here", // 使用 sing-box generate reality-keypair 生成
"short_id": ["your-short-id-1"] // 自定义 short_id 字符串
}
}
}
],
"outbounds": [
{
"type": "direct",
"tag": "direct"
}
]
}
🔑 第三步:生成 Reality 秘钥对
使用 Docker 临时生成一对唯一的 Reality 秘钥(PrivateKey 与 PublicKey):
docker run --rm ghcr.io/sagernet/sing-box:latest generate reality-keypair
终端会输出如下格式的内容:
PrivateKey:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxPublicKey:yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
将 PrivateKey 填入服务端 /etc/sing-box/config.json 的 private_key 字段;将 PublicKey 妥善记录,用于后续客户端配置。
🚀 第四步:使用 Docker Compose 一键启动
在 /etc/sing-box/ 目录下创建 docker-compose.yml:
version: "3.8"
services:
sing-box:
image: ghcr.io/sagernet/sing-box:latest
container_name: sing-box-server
restart: always
network_mode: host
volumes:
- ./config.json:/etc/sing-box/config.json
在终端运行启动指令:
docker compose up -d
docker compose logs -f
❓ 常见问题与 AI 快问快答 (FAQ)
Q1: 为什么要选择 images.apple.com 或 www.microsoft.com 作为伪装域名?
答:Reality 要求借用的伪装域名必须支持 TLS 1.3、HTTP/2,且公网访问量巨大。苹果和微软的大型 CDN 节点在防火墙看来有极其合规的流量特征,不易触发主动探测。
Q2: 搭建完节点后,客户端配置中还需要注意什么?
答:客户端配置中的 tls.utls 必须启用并选择 chrome(桌面端)或 safari(苹果移动端),保持 TLS 客户端指纹与真实浏览器一致,才能做到完全无懈可击。
(主机选购推荐:自建 Reality 节点需要服务器拥有优质干净的 IP 段与优秀的出口宽带。欢迎阅读 《2026 国外 VPS 选购避坑指南》,获取 DMIT、搬瓦工、CloudCone 与 RackNerd 的折扣通道;如不想维护 VPS,可参考 《“饿饭CC云”深度评测》 选择商业 IPLC 专线服务。)