安装 XrayREALITY 支持需要 Xray v1.8.0 以上

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" install --beta

更新 geoipgeosite

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" install-geodata

生成 privatekey

xray x25519

服务端完整配置

{
"log": {
"loglevel": "warning",
"access": "/var/log/xray/access.log",
"error": "/var/log/xray/error.log"
},
"dns": null,
"transport": null,
"stats": null,
"reverse": null,
"fakeDns": null,
"routing": {
"rules": [
{
"type": "field",
"outboundTag": "common",
"network": "udp,tcp"
},
{
"type": "field",
"outboundTag": "blocked",
"ip": [
"geoip:cn",
"geoip:private"
]
}
]
},
"inbounds": [
{
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "", // 运行 xray uuid 生成
"flow": "xtls-rprx-vision"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "tcp",
"security": "reality",
"realitySettings": {
"show": false,
"dest": "www.microsoft.com:443",
"xver": 0,
"serverNames": [
"www.microsoft.com"
],
"privateKey": "", // 前面生成的 private key
"shortIds": [
"" // 运行 openssl rand -hex 8 生成
]
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [
{
"tag": "common",
"protocol": "freedom"
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
}
],
"policy": {
"levels": {
"0": {
"handshake": 5,
"connIdle": 120
}
}
}
}

把配置文件写入 /usr/local/etc/xray/config.json
重启 Xray

systemctl restart xray