生成并使用客户端配置
0. 在服务器上,客户端配置会自动生成在: /root/client.json
1. 复制 /root/client.json 到本地机器。
2. 运行:
xray -c client.json
3. 使用本地代理:
- SOCKS5:
127.0.0.1:10808 - HTTP 代理:
127.0.0.1:10809
端口
- 服务器监听:
443/tcp(VLESS + REALITY) - 客户端 SOCKS 代理:
127.0.0.1:10808 - 客户端 HTTP 代理:
127.0.0.1:10809
关键文件与位置
- Systemd 服务
/etc/systemd/system/xray.service - 二进制:
/usr/local/bin/xray - 服务器配置:
/usr/local/etc/xray/config.json - 客户端配置:
/root/client.json - VLESS 链接:
/root/client.vless - 地理数据:
/usr/local/share/xray/{geoip.dat, geosite.dat} - 日志:
/var/log/xray/{access.log, error.log} - REALITY 密钥:
/root/.keys
管理 Xray 服务
# Start / Stop / Restart / Status
systemctl start xray
systemctl stop xray
systemctl restart xray
systemctl status xray
注意事项
- 此安装主要安装并配置 Xray-core(服务器端)。
- 提供的客户端配置是基础配置,可能无法在所有网络或受限环境中正常工作。
- 如果你处于受审查或受限的网络环境中,配置可能需要调整。
- 任何配置更改(服务器或客户端)之后,都要重启 Xray:
systemctl restart xray