使用 VMess 协议结合 WebSocket(WS)和前置 CDN 的方案具有以下优点:
隐蔽性:WebSocket 协议可以伪装成正常的 Web 流量,这使得 VMess+WS 流量更难被检测和阻断。
穿透性:WebSocket 通常能够穿透企业和国家级的防火墙。
性能:使用 CDN 可以优化数据传输速度,减少延迟,尤其是在跨国连接时。
安全性:VMess 协议本身包含加密和认证机制,确保数据传输的安全性。
稳定性:结合 CDN 使用,流量的分发更加均匀,有助于提高系统的稳定性和可靠性。
请注意,虽然这种配置增强了隐蔽性和穿透力,但没有任何技术可以保证100%的不被屏蔽,特别是在不断变化的网络审查环境下。
教程代码:
在云服务器上安装 V2Ray :
更新系统
Bash
sudo apt update
安装依赖包
Bash
sudo apt install curl unzip
下载载并运行 V2Ray 安装脚本
Bash
curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh
给脚本加上执行权限
Bash
chmod +x install-release.sh
安装脚本
Bash
sudo bash install-release.sh
使用nano编辑器给v2ray添加配置代码
Bash
sudo nano /usr/local/etc/v2ray/config.json
配置V2ray config.json代码
Bash
{
"log": {
"loglevel": "warning",
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log"
},
"inbounds": [
{
"port": 10000,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "改成自己的uuid",
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/ray"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
关闭防火墙
Bash
ufw disable
启动 V2Ray 服务
Bash
sudo systemctl start v2ray
检查 V2Ray 服务状态
Bash
systemctl status v2ray
设置 V2Ray 自动启动
Bash
sudo systemctl enable v2ray
再次检查 V2Ray 服务状态
Bash
systemctl status v2ray
安装Nginx作为反向代理:
首先云将服务器ip地址指向域名,给域名添加记录,使用cloudclfare解析域名
安装 Nginx
Bash
sudo apt install nginx
创建并配置 Nginx 虚拟主机文件
Bash
sudo nano /etc/nginx/conf.d/v2ray.conf
配置代码
Bash
server {
listen 80;
server_name 自己的域名;
index index.html;
root /usr/share/nginx/html/;
access_log /var/log/nginx/v2ray.access;
error_log /var/log/nginx/v2ray.error;
location /ray {
if ($http_upgrade != "websocket") {
return 404;
}
proxy_redirect off;
proxy_pass http://127.0.0.1:10000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
重启 Nginx 服务
Bash
sudo systemctl restart nginx
检查nginx是否已经成功启动
Bash
sudo systemctl status nginx
设置Nginx 自动启动
Bash
sudo systemctl enable nginx
再次检查Nginx状态
Bash
systemctl status nginx
最后在浏览器中打开域名,出现以下提示,表示成功
Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
配置客户端:
下载v2ray和xray
xray下载地址:https://github.com/XTLS/Xray-core/releases/tag/v1.8.4
v2ray下载地址:https://github.com/v2fly/v2ray-core/releases
发表评论 (已有0条评论)