宝塔docker容器搭建v2ray并启用ws协议。
首先你需要有个服务器安装宝塔,然后在软件商城里面安装docker管理器,我的实测环境是centos系统。
在此之前你可以添加一个阿里云加速地址,具体点击这里,然后获取一下v2ray的镜像,如下:
接下来创建容器,内容根据实际情况自行修改,如下:
然后进入/etc/v2ray目录下,新建一个config.json文件,内容如下:
{
"inbounds": [{
"port": 65535,
"listen": "0.0.0.0",
"protocol": "vmess",
"settings": {
"clients": [{
"id": "b75eabaa-f573-4f8b-acff-15c51f7ef35f",
"alterId": 64
}]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/onx8com/"
}
}
}],
"outbounds": [{
"protocol": "freedom",
"settings": {}
}],
"dns": {
"servers": ["https+local://1.1.1.1/dns-query", "1.1.1.1", "1.0.0.1", "8.8.8.8", "8.8.4.4", "localhost"]
},
"routing": {
"strategy": "rules",
"settings": {
"rules": [{
"type": "field",
"ip": ["0.0.0.0/8", "10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.2.0/24", "192.168.0.0/16", "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "::1/128", "fc00::/7", "fe80::/10"],
"outboundTag": "blocked"
}]
}
}
}
然后找到绑定域名的主机配置文件,添加以下内容:
#Apache
<LocationMatch "/onx8com/">
ProxyPass ws://你的域名:65535/onx8com/ upgrade=WebSocket
ProxyAddHeaders Off
ProxyPreserveHost On
RequestHeader set Host %{HTTP_HOST}s
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
</LocationMatch>
#Nginx
location /onx8com/
{
proxy_pass http://0.0.0.0:65535;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
接着重新启动一下docker镜像服务端就部署完成了,操作如下:
docker ps -a
#找到v2ray的容器名
docker restart 容器名
最后附上客户端的配置图,完毕。
文章版权归原作者所有或来自互联网,未经允许请勿转载。如有侵权请联系我删除,谢谢!
THE END
二维码
打赏
共有 0 条评论