场景

V2ray开始支持gRPC作为底层传输方式,各位大佬已经上车了,于是打算尝尝鲜。
由于墙外VPS是Ubuntu 14.04,Nginx版本低于1.13.10,没法使用gRPC。升级Nginx看上一篇

修改配置

V2ray服务端配置

查阅V2ray的gRpc配置

关闭V2ray服务

1
root@vultr:~# service v2ray stop

修改V2ray配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"inbounds":[{
"port": 12345,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "712df412-9afa-49d8-8309-f969313de504"
}
]
},
"streamSettings": {
"network":"grpc",
"grpcSettings":{
"serviceName": "#gRpcService#" //nginx转发的gRPC服务名
}
},
"listen": "127.0.0.1"
}]
}

启动V2ray

1
root@vultr:~# service v2ray start

Nginx配置

Nginx原来的配置不变,修改location节点下

关闭Nginx服务

1
root@vultr:~# service nginx stop

修改Nginx配置

1
2
3
4
5
6
7
server {
#常规配置
location /GunService {
#gRpc的其他配置
grpc_pass grpc://127.0.0.1:12345
}
}

启动Nginx服务

1
root@vultr:~# service nginx start

V2ray客户端配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"outbound": {
"streamSettings": {
"network": "grpc",
"security":"tls", //如果连接采用https,这里需要用tls,以及配置tlsSettings
"tlsSettings": {
"allowInsecure": false,
"serverName": "#Domain#"
},
"tcpSettings": null,
"kcpSettings": null,
"wsSettings": null,
"grpcSettings": {
"serviceName": "#gRpcService#",
"multiMode": true
},
"httpSettings": null
}
}
}