VMess over WebSocket with TLS是目前最成熟的V2Ray配置方案。服务端config.json:
{
"inbounds": [{
"port": 10086,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [{"id": "YOUR-UUID", "alterId": 0}]
},
"streamSettings": {
"network": "ws",
"wsSettings": {"path": "/v2ray"}
}
}],
"outbounds": [{"protocol": "freedom"}]
}
配合Nginx反向代理,将WebSocket请求转发到V2Ray:
location /v2ray {
proxy_pass http://127.0.0.1:10086;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
Nginx处理TLS终止,V2Ray监听本地端口,流量完全伪装成HTTPS网站访问。