VLESS 部署指南(sing-box)
VLESS + Reality + xtls-rprx-vision:不需要域名和证书,握手伪装成普通 HTTPS。需要 sing-box 1.14.0 及以上。字段见 VLESS inbound 与 TLS / Reality。
准备
- 带 systemd 的 Linux VPS,有 root 或
sudo;官方安装脚本覆盖 deb、rpm、Arch、OpenWrt。 - 安全组和本机防火墙放行 TCP
443,且端口未被占用。 - VPS 能出站访问 443,Reality 握手要转发到伪装站点。
安装
curl -fsSL https://sing-box.app/install.sh | sh
sing-box version版本必须 ≥ 1.14.0。
密钥
sing-box generate reality-keypair
sing-box generate uuid
openssl rand -hex 4PrivateKey 只放服务端,PublicKey 给客户端。不要手编 UUID。short_id 是偶数长度的十六进制,解码后不超过 8 字节,也就是最多 16 个字符。
服务端
写入 /etc/sing-box/config.json。使用 Vision 时不要开 multiplex。
{
"log": {
"level": "info",
"timestamp": true
},
"inbounds": [
{
"type": "vless",
"listen": "::",
"listen_port": 443,
"users": [
{
"uuid": "CHANGE_THIS_TO_GENERATED_UUID",
"flow": "xtls-rprx-vision"
}
],
"tls": {
"enabled": true,
"server_name": "www.microsoft.com",
"reality": {
"enabled": true,
"handshake": {
"server": "www.microsoft.com",
"server_port": 443
},
"private_key": "CHANGE_THIS_TO_PRIVATE_KEY",
"short_id": [
"CHANGE_THIS_TO_SHORT_ID"
]
}
}
}
],
"outbounds": [
{
"type": "direct"
}
]
}| 配置项 | 填入 |
|---|---|
users[0].uuid |
sing-box generate uuid |
tls.reality.private_key |
密钥对里的 PrivateKey |
tls.reality.short_id |
openssl rand -hex 4 的输出 |
tls.server_name / handshake.server |
同一个伪装站点 |
listen |
禁用 IPv6 时改为 0.0.0.0 |
伪装站选支持 TLS 1.3 和 HTTP/2、且 VPS 能访问的站点,不要用自己控制或容易关停的站。server_name、handshake.server 和客户端 server_name 必须一致。先用 curl -I 确认出站可达。
sudo chmod 600 /etc/sing-box/config.json
sudo sing-box check -c /etc/sing-box/config.json
sudo systemctl enable sing-box
sudo systemctl restart sing-box日志:sudo journalctl -u sing-box -e。
客户端
本机代理是 127.0.0.1:1080。官方把 uTLS 标为不推荐,字段仍在,示例继续用 chrome。
{
"log": {
"level": "info",
"timestamp": true
},
"inbounds": [
{
"type": "mixed",
"listen": "127.0.0.1",
"listen_port": 1080
}
],
"outbounds": [
{
"type": "vless",
"tag": "vless-out",
"server": "YOUR_SERVER_IP",
"server_port": 443,
"uuid": "CHANGE_THIS_TO_GENERATED_UUID",
"flow": "xtls-rprx-vision",
"tls": {
"enabled": true,
"server_name": "www.microsoft.com",
"utls": {
"enabled": true,
"fingerprint": "chrome"
},
"reality": {
"enabled": true,
"public_key": "CHANGE_THIS_TO_PUBLIC_KEY",
"short_id": "CHANGE_THIS_TO_SHORT_ID"
}
}
}
]
}客户端 short_id 是字符串,取服务端数组中的一项。flow 要么两端都开,要么都不开。
多用户时在 users 里加独立 UUID,共用同一组 Reality 密钥和 short_id。Reality 不申请证书:握手借用伪装站,服务端只保存自己的密钥对。
排查
private_key要完整,结尾不要带引号或空格。short_id必须是偶数长度,且不超过 16 个十六进制字符。- UUID 必须有效。Vision 下不要开
multiplex。端口占用看sudo ss -lntp | grep ':443'。禁用 IPv6 时不要听::。 - 客户端的
uuid、flow、server_name、public_key、short_id与服务端一致。安全组放行 TCP 443。 - 时间差过大也会握手失败。
tls.reality.max_time_difference省略时不检查;需要放宽时用官方示例1m。 - 出站访问不了伪装站就换
handshake.server:curl -I --max-time 10 https://www.microsoft.com。
安全
UUID、密钥对和 short_id 都用生成命令,不要手编。config.json 权限 600。私钥只留在服务端。Vision 不要搭配 multiplex。升级后重新执行 sing-box check。