1.先安装宝塔,然后配置网站和ssl
2.安装v2ray
使用2333boy的脚本,选择ws+tls
bash <(curl -s -L https://git.io/v2ray.sh)
记住配置的端口号,和不自动配置tls
3.网站在宝塔里搭建后,配置证书后开启https
修改网站的配置
location /foxzc {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
if ($http_upgrade = "websocket" ){#判断是否是ws,是就反代,不是就正常访问网站
proxy_pass http://127.0.0.1:10000;# 10000 为 V2Ray 端口
}
}
v2ray的配置文件
{
"inbounds": [
{
"port": 10000,
"listen":"0.0.0.0",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "c1111175-0af3-48b6-y599-30165432104d",
"level": 0
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/foxzc"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
添加上面的代码,保存并重启Nginx,就好了。