| v2ray
 以下的方法基于DEBIAN10,宝塔面板,测试Debian8,9,10,11通用,
 
 第一步:新增网站 第二步:设置SSL 第三步:设置Nginx 在宝塔面板网站域名设置-配置文件中添加如下代码     location /ws
    {      #这个路径随便怎么设置
        proxy_redirect off;
        proxy_pass http://127.0.0.1:8888;    #这个端口随便怎么设置,但是要在防火墙中放行
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
    }
 ▲在SSH中 运行一键脚本命令 先安装Curl  apt-get update -y && apt-get install curl -y 
 第四步:安装V2Ray(需要先安装Curl) bash <(curl -L -s https://install.direct/go.sh) 
 第五步:修改V2Ray配置文件 {
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "info"
      },
  "inbounds": [
    {
    "port": 8888, #v2Ray访问端口,自定义,但需要和Nginx设置的一致
    "listen":"127.0.0.1",
    "protocol": "vmess",
     "allocate": {
      "strategy": "always"
    },
    "settings": {
      "clients": [
        {
          "id": "UUID", #自定义UUID,可以直接选择与putty中运行v2ray官方一键脚本保持一致
          "alterId": 64,
          "level": 1,
          "security": "aes-cfb-128" #自定义加密方式
        }
      ]
    },
    "streamSettings": {
    "network":"ws",
    "wsSettings": {
        "connectionReuse": false,    
        "path": "/ws/" #自定义路径,但需要和Nginx设置的一致
        }
       }
      }
     ],
  "outbounds": [
    {
    "protocol": "freedom",
    "settings": {}
      }
   ],
  "outboundDetour": [
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "strategy": "rules",
    "settings": {
      "rules": [
        {
          "type": "field",
          "ip": ["geoip:private"],
          "outboundTag": "blocked"
        }
      ]
    }
  }
}
 第六步:重启V2Ray服务 service v2ray restart
service v2ray status #通过该命令,可查看v2ray是否运行成功
systemctl enable v2ray #通过该命令,设置v2ray开机自动启动 
 第七步:在客户端配置v2ray 地址为你的域名;
端口为443;
Uuid为刚刚设置的uuid;
协议为Websocket(ws);
路径为 /ws(或者你设置的路径);
开启tls。 |