注意:
本教程仅供学习使用!
教程开始
1、安装宝塔
宝塔官方地址:https://www.bt.cn/
Centos安装命令:
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh
Ubuntu/Deepin安装命令:
wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && sudo bash install.sh
Debian安装命令:
wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && bash install.sh
Fedora安装命令:
wget -O install.sh http://download.bt.cn/install/install.sh && bash install.sh
宝塔安装完成后会出现以下内容,在网页上面登录即可。
2、安装Nginx
不做网站用的只要勾选Nginx就好,其他取消掉
如做网站用的就默认一键安装如Nginx,PHP,mysql等
选择一键安装。
3、安装V2ray
这里使用的是官方的脚本,偷个小懒。哈哈~
bash <(curl -L -s https://install.direct/go.sh)
4、设置开机启动:
systemctl enable v2ray
5、伪装V2ray
选择网站,添加站点
申请ssl,选择Let’s Encrypt申请证书
编辑配置,选择左侧的配置文件
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
然后在最后两个重定向前面加上:
location /ws {
proxy_redirect off;
proxy_pass http://127.0.0.1:2345;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
}
保存即可,注意这个2345的端口是待会v2ray要配置的端口 /ws是websocket位置。
6、修改V2ray配置文件
输入vi /etc/v2ray/config.json (windows直接打开你下的v2raycore里的)
然后全部替换成下面的(部分数据要改成你刚刚设置的)
{
"policy": {
"levels": {
"0": {
"uplinkOnly": 0,
"downlinkOnly": 0,
"connIdle": 150,
"handshake": 4
}
}
},
"inbound": {
"listen": "127.0.0.1",
"port": 2345, //刚刚的端口
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "f8a3c5e0-d747-4bf2-895a-4a78a6da1e2f",
"level": 1,
"alterId": 32
}
]
},
"streamSettings": {
"network": "ws",
"security": "auto",
"wsSettings": {
"path": "/ws",//刚刚的目录
"headers": {
"Host": "域名"//刚刚的网站域名
}
}
}
},
"outbound": {
"protocol": "freedom",
"settings": { }
},
"outboundDetour": [
{
"protocol": "blackhole",
"settings": { },
"tag": "blocked"
}
],
"routing": {
"strategy": "rules",
"settings": {
"rules": [
{
"type": "field",
"ip": [
"::1/128",
"fc00::/7",
"fe80::/10"
],
"outboundTag": "blocked"
}
]
}
}
}
7、现在启动v2ray
启动命令
systemctl start v2ray
查看状态
systemctl status v2ray
8、客户端配置
好了,教程结束,小伙伴们Enjoy~~~
排错:
很多新手小白容易在填写v2ray配置文件的时候填错内容,导致v2ray服务无法启动。这里给一个简单排错的方案。
1、确认端口是否冲突或者超过了系统的端口限制,端口范围推荐(1024-65535)。
2、如果是json格式错误可以利用这个网站进行排查json.cn
这种情况说明json格式是正常的。
如果有错误的话,就会如下图,在右边会提示出错的行数,进行对照修改就好了。
Comments | NOTHING