> For the complete documentation index, see [llms.txt](https://3385706034.gitbook.io/note/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://3385706034.gitbook.io/note/ws-v2ray.md).

# V2Ray & ws+tls+https

## 前期准备

### 加速

```
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
```

推荐BBR Plus

### 域名

购买域名并在[FreeSSL](https://freessl.cn/)申请证书,证书后缀\[.crt .key]

证书文件获取后，请把公钥文件和私钥文件上传至服务器上，配置时需要用到。

## 配置 V2Ray WebSocket tls

### v2-ui安装

```
bash <(curl -Ls https://blog.sprov.xyz/v2-ui.sh)
```

http\://<服务器IP>:65432 即可访问面板,默认用户名和密码都是 admin

#### 面板其它操作

```
v2-ui                  # 显示管理菜单 (功能更多)
v2-ui start            # 启动 v2-ui 面板
v2-ui stop             # 停止 v2-ui 面板
v2-ui restart          # 重启 v2-ui 面板
v2-ui status           # 查看 v2-ui 状态
v2-ui enable           # 设置 v2-ui 开机自启
v2-ui disable          # 取消 v2-ui 开机自启
v2-ui log              # 查看 v2-ui 日志
v2-ui update           # 更新 v2-ui 面板
v2-ui install          # 安装 v2-ui 面板
v2-ui uninstall        # 卸载 v2-ui 面板
```

**直接设置inbound,v2-ui添加账号 两者选其一**

inbound 配置:

```javascript
{
  "port": 443,
  "protocol": "vmess",
  "settings": {
    "clients": [{
      "id": "自行生成 UUID",
      "alterId": 64
     }]
  },
  "streamSettings": {
    "network":"ws",
    "security": "tls",
    "wsSettings":{
      "path":"/",
      "headers":{}
    },
    "tlsSettings": {
      "serverName": "填写域名，如：xxx.com",
      "certificates": [{
        "certificateFile": "公钥文件绝对路径，如：/path/to/xxx.com.crt",
        "keyFile": "私钥文件绝对路径，如：/path/to/xxx.com.key"
      }]
    }
  }
}
```

v2-ui 面板添加账号:

![](http://image.violetevergarden.top/image/ws-image1.png)

主要说明一下 tls 配置，域名要解析到你安装了 v2ray 的 VPS 的 IP。证书文件一般是 .pem / .crt 后缀名，密钥文件一般是 .key 后缀名，或者也可能是 .pem，文件名一般会带 “key” 的字样。

直接用文本方式打开它们，选择【证书文件内容】，将两个文件的内容分别填进去

![](http://image.violetevergarden.top/image/ws-image2.png) ![](http://image.violetevergarden.top/image/ws-image3.png)
