docker run --rm ghcr.io/xtls/xray-core:latest uuid
记录 uuid
wget https://github.com/XTLS/Xray-core/releases/download/v1.8.4/Xray-linux-64.zip
apt-get install -y unzip
unzip Xray-linux-64.zip
./xray x25519
记录 public key 和private key
vim config.json
{"log": {"loglevel": "warning"},"inbounds": [{"port": 443,"protocol": "vless","settings": {"clients": [{"id": "【填入第一步生成的 UUID】","flow": "xtls-rprx-vision"}],"decryption": "none"},"streamSettings": {"network": "tcp","security": "reality","realitySettings": {"show": false,"dest": "www.microsoft.com:443","serverNames": ["www.microsoft.com","www.microsoft.com"],"privateKey": "【填入第一步生成的 Private Key】","shortIds": ["16","1688"]}}}],"outbounds": [{"protocol": "freedom","tag": "direct"}]
}
vim docker-compose.yml
services:xray:image: ghcr.io/xtls/xray-core:latestcontainer_name: xray_realityrestart: alwaysnetwork_mode: "host"user: "root" command: run -c /etc/xray/config.jsonvolumes:- ./config.json:/etc/xray/config.json
重启 docker
docker compose down
docker compose up -d
看有没有输出
netstat -tlpn | grep 443
最后配置字符串
vless://【你的UUID】@【你的VPS_IP】:443?encryption=none&flow=xtls-rprx-vision&security=reality&sni=www.microsoft.com&fp=chrome&pbk=【你的Public_Key】&sid=16&type=tcp&headerType=none#MyVPS