配置 VLESS 节点文件 VLESS 的配置文件通常位于 /etc/xray/config.json 或者用户目录下的 .xray/config.json。 核心配置字段: 节点配置:{ "node": { "listen": "...:789", // 监听地址和端口 "port": 789, // 代理端口 "socks": "127...1:108", // Socks5 代理地址和端口 "direct": "127...1:1081", // 直连地址和端口 "in": "127...1:1082", // 内部接入地址和端口 "out": "127...1:1083", // 外部接入地址和端口 "udp": true, // 是否启用 UDP 转发 "ipv6": true // 是否启用 IPv6 转发 } } 域名解析:{ "domain": "your-domain.com", // 域名 "port": 80, // HTTP 端口 "https": 443, // HTTPS 端口 "socks": "127...1:108" // Socks5 代理地址和端口 } 节点管理:{ "nodes": { "your-domain.com": { "ip": "your-ip", "port": 80,...
配置 VLESS 节点文件
VLESS 的配置文件通常位于 /etc/xray/config.json 或者用户目录下的 .xray/config.json。
核心配置字段:
- 节点配置:
{ "node": { "listen": "...:789", // 监听地址和端口 "port": 789, // 代理端口 "socks": "127...1:108", // Socks5 代理地址和端口 "direct": "127...1:1081", // 直连地址和端口 "in": "127...1:1082", // 内部接入地址和端口 "out": "127...1:1083", // 外部接入地址和端口 "udp": true, // 是否启用 UDP 转发 "ipv6": true // 是否启用 IPv6 转发 } } - 域名解析:
{ "domain": "your-domain.com", // 域名 "port": 80, // HTTP 端口 "https": 443, // HTTPS 端口 "socks": "127...1:108" // Socks5 代理地址和端口 } - 节点管理:
{ "nodes": { "your-domain.com": { "ip": "your-ip", "port": 80, "protocol": "http", "sniproxy": true, "reverse": true, "weight": 1, "max_connections": 100, "max_fallbacks": 3, "fallback": "127...1:80", "health_check": { "enabled": true, "url": "http://your-domain.com/health", "interval": 300, "timeout": 200, "method": "GET" } } } } - 负载均衡:
{ "loadbalancer": { "enabled": true, "algorithm": "roundrobin", // 轮询 "weight": [1, 1, 1], // 权重分配 "max_connections": 100 // 最大连接数 } }
节点管理
- 动态节点配置:
xrayctl add your-domain.com --ip your-ip --port 80 --protocol http --sniproxy xrayctl add your-domain.com --reverse
- 节点状态查询:
xrayctl stats your-domain.com
- 节点删除:
xrayctl del your-domain.com
域名解析配置
- 使用
nsd或djbdns等 DNS 解析工具,解析域名指向你的节点 IP。 - 或者直接在路由器上配置域名解析。
安全配置
- 访问控制:
{ "access": { "enabled": true, "ip": ".../", "mask": 255.255.255.255, "blacklist": [ ".../8", "127...1/24", "192.168.1./24" ], "whitelist": [ ".../", "127...1/24" ] } } - 速率限制:
{ "速率限制": { "enabled": true, "name": "速率限制", "ip": "...", "min": 0, "max": 100, "ечно": true, "ечno": true } }
日志和监控
- 日志配置:
{ "log": { "level": "debug", "file": "/var/log/xray/access.log", "max_size": 128, "keep": 7, " rotate": true, "interval": 60 } } - 监控配置:
# 使用 Prometheus 和 Grafana 导出统计数据 xrayctl export 127...1:909
性能优化
- 并发连接数:
{ "options": { "max_parallel": 100, "keepalive": 5, "timeout": 30000, "reconnect": true, "fastopen": true } } - TCP 配置:
{ "tcp": { "max_conns": 100, "max_fails": 3, "socket": SO_SNDTIMEO | SO_RCVTIMEO | SO_KEEPALIVE | SO_REUSEADDR } }
测试和验证
- 访问测试:
- 使用
curl或telnet测试端口连通性。 - 测试域名解析是否正确。
- 测试负载均衡是否正常分配请求。
- 使用
- 性能测试:
- 使用
netperf或iperf测试带宽和延迟。
- 使用
故障排除
- 如果节点出现问题,可以检查:
- 网络连接是否正常。
- 配置文件是否正确。
- 日志是否有错误信息。
- 负载均衡是否配置正确。

相关文章








