找回密码
 立即注册
搜索
首页 网站运维 网站编辑 查看内容

v2ray宝塔面板部署超简单方法

作者:zouyang5 2023-12-14 01:52 137人关注

v2ray以下的方法基于DEBIAN10,宝塔面板,测试Debian8,9,10,11通用,第一步:新增网站第二步:设置SSL第三步:设置Nginx在宝塔面板网站域名设置-配置文件中添加如下代码location/ws {#这个路径随便怎么设置 proxy_redir ...

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。

路过

雷人

握手

鲜花

鸡蛋
来自: Z记录

全部回复(0)

返回顶部