xray安装 wget https://github.com/XTLS/Xray-core/releases/download/v1.8.1/Xray-linux-64.zip unzip Xray-linux-64.zip cp xray /usr/bin mkdir /etc/xray cp *.dat /etc/xray xray systemd服务 [Unit] Description=Xray Service Documentation=https://github.com/xtls After=network.target nss-lookup.target [Service] ExecStart=/usr/bin/xray run -config /etc/xray/config.json Environment="XRAY_LOCATION_ASSET=/etc/xray" Restart=on-failure RestartPreventExitStatus=23 LimitNPROC=10000 LimitNOFILE=1000000 [Install] WantedBy=multi-user.target 注意:若xray所在目录和geosite.dat所在目录不一致,需要设置环境变量XRAY_LOCATION_ASSET,不设置此环境变量会导致默认将geosite.dat定位至/use/bin,此目录无geosite.dat,因此服务会报错无法启动
设置systemd服务自动启动
sudo systemctl enable --now xray vless+websocket+tls和vless+nginx+grpc+tls容易被识别,不建议使用
vless reality配置 服务端
{ "log": { "loglevel": "info", "access": "/var/log/xray/access.log", "error": "/var/log/xray/error.log" }, "inbounds": [ // 服务端入站配置 { "port": 443, "protocol": "vless", "settings": { "clients": [ { "id": "UUID", // 必填,执行 ./xray uuid 生成,或 1-30 字节的字符串 "flow": "xtls-rprx-vision" // 选填,若有,客户端必须启用 XTLS } ], "decryption": "none" }, "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "show": false, // 选填,若为 true,输出调试信息 "dest": ":PORT", // 必填,格式同 VLESS fallbacks 的 dest,回退到Nginx监听端口 "xver": 0, // 选填,格式同 VLESS fallbacks 的 xver "serverNames": [ // 必填,客户端可用的 serverName 列表,暂不支持 * 通配符 "SNI" ], "privateKey": "privateKey", // 必填,执行 ./xray x25519 生成 "minClientVer": "", // 选填,客户端 Xray 最低版本,格式为 x.y.z "maxClientVer": "", // 选填,客户端 Xray 最高版本,格式为 x.y.z //"maxTimeDiff": 0, // 选填,允许的最大时间差,单位为毫秒 "shortIds": [ // 必填,客户端可用的 shortId 列表,可用于区分不同的客户端 "shortId" // 0 到 f,长度为 2 的倍数,长度上限为 16 ] } } } ], "outbounds": [ { "protocol": "freedom", "settings" : { "domainStrategy": "UseIPv6" }, "tag": "direct" }, { "protocol": "blackhole", "tag": "blocked" } ], "routing": { "domainStrategy": "IPIfNonMatch", "rules": [ { "inboundTag": [ "api" ], "outboundTag": "api", "type": "field" }, { "domain": [ "domain:iqiyi.com", "domain:video.qq.com", "domain:youku.com" ], "type": "field", "outboundTag": "blocked" }, { "type": "field", "ip": [ "geoip:cn", "geoip:private" ], "outboundTag": "blocked" }, { "protocol": [ "bittorrent" ], "type": "field", "outboundTag": "blocked" } ] } } 客户端
...