Xray-examples
Xray-examples copied to clipboard
客户端出站vmess+tcp+tls 服务器入站vmess+tcp+tls. 连接失败,附带配置,求高人指点迷津。
这是服务器的配置(服务器入站配置)。
{
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "ddd", // 填写你的 UUID
"flow": "xtls-rprx-vision",
"level": 0,
"email": "[email protected]"
}
],
"decryption": "none",
"fallbacks": [
{
"dest": 8080 // 默认回落到防探测的代理
},
{
"path": "/vmesstcp", // 必须换成自定义的 PATH
"dest": 2345,
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": "http/1.1",
"certificates": [
{
"certificateFile": "/home/jamin/xray_cert/xray.crt",
"keyFile": "/home/jamin/xray_cert/xray.key"
}
]
}
}
},
{
"port": 2345,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id":"dddd", // 填写你的 UUID
"level": 0,
"email": "[email protected]"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "none",
"tlsSettings": {
"certificates": [
{
"certificateFile": "/home/jamin/xray_cert/xray.crt",
"keyFile": "/home/jamin/xray_cert/xray.key"
}
]
},
"tcpSettings": {
"acceptProxyProtocol": true,
"header": {
"type": "http",
"request": {
"path": [
"/vmesstcp" // It must be replaced with a custom PATH, which needs to be consistent with the shunt
]
}
}
}
}
},
这是我的客户端配置(客户端出站配置):
{
"tag": "other",
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "xxxxx", // 换成你的域名或服务器 IP(发起请求时无需解析域名了)
"port": 443,
"users": [
{
"id": "xxxx", // 填写你的 UUID
"security": "none",
"level": 0
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"serverName": "xxxx" // 换成你的域名
},
"tcpSettings": {
"header": {
"type": "http",
"request": {
"path": [
"/vmesstcp" // 必须换成自定义的 PATH,需要和服务端的一致
]
}
}
}
}
}
服务器配置中非常非常奇怪的是"security"的值必须是“none”客户端就能连接到服务器。如果"security"的值是"tls"客户端就不能连到服务器, 求高人指点 ,先谢谢了。
@cppbeliever 首先如果你要开TLS,那么 tcp settings完全 没有必要写。
@cppbeliever 根据你服务器的 127.0.0.1和2345来看,你的xray的前面还有个web服务器 配置了证书提供TLS,此时服务端xray当然就没法再 配置证书了。
@5e2t 上面的服务器配置是回落后的配置,所以tcp setting里面必须有path,这样和回落匹配。
@cppbeliever 所以 你这配置 名为TCP ,实为HTTP
@cppbeliever 你的web服务器配置证书提供TLS了,反代了xray,web服务器向xray 发起连接时,用的是HTTP而非HTTPS。
@5e2t 我的服务器是根据xray的小小白白话文做的 ,这样说的话,xray前面确实有个nginx
@cppbeliever 所以你服务器 的security 为 none 没有任何问题。
@cppbeliever 你的web服务器配置证书提供TLS了,反代了xray,web服务器向xray 发起连接时,用的是HTTP而非HTTPS。
我是小白,没彻底明白,可以说得详细点么?谢谢了
@cppbeliever 反向代理服务器回源时,可以用HTTP ,也可以用HTTPS,都可以改。 就是策略问题而已,但你这是纯粹在本机上进行的操作,是完全没有必要在回源时再开TLS的。
@cppbeliever 反向代理服务器回源时,可以用HTTP ,也可以用HTTPS,都可以改。 就是策略问题而已,但你这是纯粹在本机上进行的操作,是完全没有必要在回源时再开TLS的。
我的客户端配置是在我自己的电脑上,服务器配置在远程vps上,不是本机上的操作
@cppbeliever 呃,我翻墙从来不带nginx
@cppbeliever 我的解释能力也 有限
@cppbeliever 我对nginx的了解也很有限= =
"本机" 指VPS,指的是 反向代理服务器 和 源服务器 都在一台机器上
{
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "ddd", // 填写你的 UUID
"flow": "xtls-rprx-vision",
"level": 0,
"email": "[email protected]"
}
],
"decryption": "none",
"fallbacks": [
{
"dest": 8080 // 默认回落到防探测的代理
},
{
"path": "/vmesstcp", // 必须换成自定义的 PATH
"dest": 2345,
"xver": 1
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"alpn": "http/1.1",
"certificates": [
{
"certificateFile": "/home/jamin/xray_cert/xray.crt",
"keyFile": "/home/jamin/xray_cert/xray.key"
}
]
}
}
},
{
"port": 2345,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id":"dddd", // 填写你的 UUID
"level": 0,
"email": "[email protected]"
}
]
},
"streamSettings": {
"network": "tcp",
"security": "none",
"tlsSettings": {
"certificates": [
{
"certificateFile": "/home/jamin/xray_cert/xray.crt",
"keyFile": "/home/jamin/xray_cert/xray.key"
}
]
},
"tcpSettings": {
"acceptProxyProtocol": true,
"header": {
"type": "http",
"request": {
"path": [
"/vmesstcp" // It must be replaced with a custom PATH, which needs to be consistent with the shunt
]
}
}
}
}
},
这是我完整的服务器配置。在443端口监听,然后vmess协议回落到本地2345端口
@cppbeliever 呃,更逆天了,你这不是web服务器配置了证书提供tls,而是xray配置了证书提供了tls
你的流量在 Nginx 被加上了 TLS,所以 xray 不需要配置 TLS
@cppbeliever 你就简单理解为,从vless回落到vmess也是用的 HTTP,而非HTTPS,所以vmess不能再配置证书提供TLS了
意思就是说,我的xray客户端连接 的是vps的443端口,这样的话,xray客户端的数据就必然首先达到vps的nginx,然后才能达到xray服务器?
@cppbeliever 你的客户端如果是vmess的话,你的数据,先到达了vless入站,然后被vless入站转交给vmess入站
@cppbeliever 你的翻墙流量到不了nginx
意思就是说,我的xray客户端连接 的是vps的443端口,这样的话,xray客户端的数据就必然首先达到vps的nginx,然后才能达到xray服务器?
我画那张图的时候还没看到你刚发的配置 你的 TLS 是 XRAY 中 vless 入站提供的
你代理流量是从上面那根 TLS 管子中的 HTTP 管子里进去的
你代理流量是从上面那根 TLS 管子中的 HTTP 管子里进去的
我的xray客户端是用的vmess+tcp+tls,没用http
@cppbeliever 呃,你需要了解一下HTTP协议的本质😂😂 你之所以能写 那个path,就是因为path是HTTP协议里的东西
@cppbeliever 你要是没用HTTP,压根写不了那个path
意思就是说,我的xray客户端连接 的是vps的443端口,这样的话,xray客户端的数据就必然首先达到vps的nginx,然后才能达到xray服务器?
我画那张图的时候还没看到你刚发的配置 你的 TLS 是 XRAY 中 vless 入站提供的
如果我把xray服务器的vless入站的security设置成none,那么在vmess中security设置tls是不是就ok了?
@cppbeliever 实际上一点都不ok,用不了的
@cppbeliever 不管vless是否提供tls,vless始终使用 HTTP回源,所以给vmess配证书还是用不了