1. 安装v2ray
1 | # 下载安装脚本并执行wget https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.shbash install-release.sh |
2. 配置v2ray
编辑配置文件 /usr/local/etc/v2ray/config.json
,以下为WebSocket + TLS的推荐配置(需配合Nginx反向代理):
1 | { |
3. 启动v2ray服务
1 | systemctl enable v2raysystemctl start v2ray |
4. 配置Nginx反向代理(通过宝塔面板)
在宝塔面板中打开网站对应的Nginx配置,添加以下反向代理规则:
1 | location /ray { # 路径与v2ray配置中的`path`一致 |
重启Nginx服务。
**5.**检查服务状态
- 直接部署:
systemctl status v2ray
- Docker部署:
docker ps grep v2ray
**6.**客户端配置
使用v2ray客户端(如V2RayN、Qv2ray),填入服务器IP/域名、端口、UUID及路径(WebSocket需填写path
)。
**7.**测试连通性
通过在线工具(如https://www.itdog.cn/tcping/
)验证端口是否开放,或使用客户端连接测试。