Initial commit: sing-box Reality + Hysteria2 deploy for 66.hyf2.cc
Ubuntu deployment at /opt/jiedian with pre-filled env for 47.76.87.111. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+165
@@ -0,0 +1,165 @@
|
||||
# Ubuntu 部署指南
|
||||
|
||||
仓库:[https://git.bz121.com/dekun/jiedian.git](https://git.bz121.com/dekun/jiedian.git)
|
||||
|
||||
| 项目 | 值 |
|
||||
|------|-----|
|
||||
| VPS IP | `47.76.87.111` |
|
||||
| 域名 | `66.hyf2.cc` |
|
||||
| 部署目录 | `/opt/jiedian` |
|
||||
| 系统 | Ubuntu 22.04 / 24.04 |
|
||||
|
||||
---
|
||||
|
||||
## 部署前准备
|
||||
|
||||
### 1. DNS 解析
|
||||
|
||||
在域名控制台添加 **A 记录**:
|
||||
|
||||
```
|
||||
66.hyf2.cc → 47.76.87.111
|
||||
```
|
||||
|
||||
验证(本地或 VPS 上执行):
|
||||
|
||||
```bash
|
||||
dig +short A 66.hyf2.cc
|
||||
# 应返回 47.76.87.111
|
||||
```
|
||||
|
||||
### 2. SSH 登录 VPS
|
||||
|
||||
```bash
|
||||
ssh root@47.76.87.111
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 一键部署(推荐)
|
||||
|
||||
在 VPS 上以 **root** 执行:
|
||||
|
||||
```bash
|
||||
# 安装 git
|
||||
apt update && apt install -y git
|
||||
|
||||
# 克隆到 /opt/jiedian
|
||||
git clone https://git.bz121.com/dekun/jiedian.git /opt/jiedian
|
||||
cd /opt/jiedian
|
||||
|
||||
# .env 已预填 IP/域名/密钥,直接安装
|
||||
bash scripts/install.sh
|
||||
```
|
||||
|
||||
安装完成后查看节点链接:
|
||||
|
||||
```bash
|
||||
cat /opt/jiedian/client/generated/share-links.txt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 分步部署(如需手动控制)
|
||||
|
||||
```bash
|
||||
apt update && apt install -y git
|
||||
git clone https://git.bz121.com/dekun/jiedian.git /opt/jiedian
|
||||
cd /opt/jiedian
|
||||
|
||||
# 检查 .env(已预配置,一般无需修改)
|
||||
cat .env
|
||||
|
||||
# 若需重新生成密钥
|
||||
bash scripts/generate-keys.sh
|
||||
|
||||
# 执行安装
|
||||
bash scripts/install.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 安装脚本做了什么
|
||||
|
||||
1. 安装 sing-box、nginx、ufw
|
||||
2. 防火墙放行:`22/tcp`、`443/tcp`、`8443/udp`
|
||||
3. Nginx 伪装站监听 `127.0.0.1:8080`
|
||||
4. acme.sh 为 `66.hyf2.cc` 申请 Let's Encrypt 证书
|
||||
5. 生成 `/etc/sing-box/config.json` 并启动 systemd 服务
|
||||
6. 输出客户端分享链接到 `client/generated/share-links.txt`
|
||||
|
||||
---
|
||||
|
||||
## 节点信息
|
||||
|
||||
| 节点 | 协议 | 地址 | 端口 |
|
||||
|------|------|------|------|
|
||||
| 主力 | VLESS + Reality | `47.76.87.111` | 443/TCP |
|
||||
| 备用 | Hysteria2 | `66.hyf2.cc` | 8443/UDP |
|
||||
|
||||
Reality 伪装 SNI:`www.microsoft.com`(不是你的域名)
|
||||
|
||||
---
|
||||
|
||||
## 部署后验证
|
||||
|
||||
```bash
|
||||
# sing-box 运行状态
|
||||
systemctl status sing-box
|
||||
|
||||
# 端口监听
|
||||
ss -tlnp | grep 443
|
||||
ss -ulnp | grep 8443
|
||||
|
||||
# 配置语法检查
|
||||
sing-box check -c /etc/sing-box/config.json
|
||||
|
||||
# 查看日志
|
||||
journalctl -u sing-box -f
|
||||
```
|
||||
|
||||
客户端导入见 [client-import.md](client-import.md)。
|
||||
|
||||
---
|
||||
|
||||
## 常用运维
|
||||
|
||||
```bash
|
||||
cd /opt/jiedian
|
||||
|
||||
# 拉取最新配置(若仓库有更新)
|
||||
git pull
|
||||
|
||||
# 重新安装/更新
|
||||
bash scripts/install.sh
|
||||
|
||||
# 证书手动续期
|
||||
/root/.acme.sh/acme.sh --renew -d 66.hyf2.cc --force
|
||||
systemctl restart sing-box
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 故障排查
|
||||
|
||||
| 问题 | 处理 |
|
||||
|------|------|
|
||||
| `dig` 未返回正确 IP | 等待 DNS 生效或检查解析记录 |
|
||||
| acme 证书失败 | 确认 80 端口可访问:`curl -I http://66.hyf2.cc` |
|
||||
| sing-box 启动失败 | `journalctl -u sing-box -n 50` 查看报错 |
|
||||
| 客户端连不上 | 核对 `share-links.txt` 与 `.env` 中密钥一致 |
|
||||
|
||||
更多见 [troubleshooting.md](troubleshooting.md)。
|
||||
|
||||
---
|
||||
|
||||
## 更新仓库(本地开发机)
|
||||
|
||||
```bash
|
||||
cd 节点
|
||||
git add .
|
||||
git commit -m "update config"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
VPS 上 `git pull` 后重新运行 `bash scripts/install.sh` 即可同步。
|
||||
@@ -0,0 +1,20 @@
|
||||
# 方案决策记录
|
||||
|
||||
## 已确认选型
|
||||
|
||||
| 项目 | 选择 | 理由 |
|
||||
|------|------|------|
|
||||
| 协议栈 | **VLESS + Reality + Hysteria2 双栈** | Reality 抗主动探测;Hysteria2 作 UDP 备用与流媒体 |
|
||||
| 服务端 | **sing-box** | 单进程同时跑 Reality 与 Hysteria2,配置统一 |
|
||||
| 系统 | **Ubuntu 22.04/24.04 或 Debian 12** | 脚本基于 apt,其他发行版需手动适配 |
|
||||
| 面板 | **无** | 个人 1–5 人,手改 `.env` + 模板即可 |
|
||||
|
||||
## 端口规划
|
||||
|
||||
- `443/TCP` — VLESS + Reality(主力)
|
||||
- `8443/UDP` — Hysteria2(备用)
|
||||
- `127.0.0.1:8080` — Nginx 伪装静态页(Reality fallback 场景)
|
||||
|
||||
## 单协议简化
|
||||
|
||||
若只想维护一种协议,删除 `server/sing-box.json.template` 中的 `hysteria2-in` inbound,并跳过证书申请步骤即可,仅保留 Reality。
|
||||
@@ -0,0 +1,152 @@
|
||||
# 客户端导入与测试指南
|
||||
|
||||
部署完成后,在 VPS 上查看 `client/generated/share-links.txt`,或本地运行 `bash scripts/render-client.sh` 生成链接。
|
||||
|
||||
---
|
||||
|
||||
## 一、连通性测试(推荐顺序)
|
||||
|
||||
### 1. Reality(TCP 443)
|
||||
|
||||
在**国内网络**下测试(不要在 VPS 本机 curl 自己):
|
||||
|
||||
```bash
|
||||
# Windows PowerShell — 仅测端口是否可达
|
||||
Test-NetConnection -ComputerName YOUR_VPS_IP -Port 443
|
||||
```
|
||||
|
||||
客户端连上后访问 https://www.google.com 或 https://ip.sb 确认出口 IP 为 VPS。
|
||||
|
||||
### 2. Hysteria2(UDP 8443)
|
||||
|
||||
UDP 无法用普通 TCP 工具测。直接导入客户端测试;若 Reality 可用但 Hysteria2 不通,可能是运营商 QoS/封锁 UDP,可继续只用 Reality。
|
||||
|
||||
### 3. 故障判断
|
||||
|
||||
| 现象 | 可能原因 |
|
||||
|------|----------|
|
||||
| ping 通 IP,客户端 timeout | 协议层问题,检查 UUID/密钥/SNI |
|
||||
| ping 不通 | IP 可能被封,考虑换 IP |
|
||||
| 连接成功但无网 | 检查 VPS 防火墙、sing-box 日志 `journalctl -u sing-box -f` |
|
||||
| Hysteria2 不通,Reality 正常 | UDP 被干扰,备用节点可忽略 |
|
||||
|
||||
---
|
||||
|
||||
## 二、Windows
|
||||
|
||||
### 方案 A:v2rayN(推荐,上手快)
|
||||
|
||||
1. 下载 [v2rayN](https://github.com/2dust/v2rayN/releases)(选 `v2rayN-With-Core.zip`)
|
||||
2. 解压运行,托盘图标 → **服务器** → **从剪贴板导入批量 URL**
|
||||
3. 复制 `share-links.txt` 中的 `vless://...` 行到剪贴板,导入
|
||||
4. 再导入 `hy2://...` 行作为备用
|
||||
5. 右键节点 → **设为活动服务器**,路由选 **绕过大陆**
|
||||
6. 系统代理 → **自动配置系统代理**
|
||||
|
||||
**手动核对 Reality 参数:**
|
||||
|
||||
| 字段 | 值 |
|
||||
|------|-----|
|
||||
| 地址 | VPS IP |
|
||||
| 端口 | 443 |
|
||||
| 用户 ID | `.env` 中的 UUID |
|
||||
| 流控 | xtls-rprx-vision |
|
||||
| 传输 | tcp |
|
||||
| 安全 | reality |
|
||||
| SNI | www.microsoft.com(或你设的 REALITY_SERVER_NAME) |
|
||||
| Fingerprint | chrome |
|
||||
| Public Key | REALITY_PUBLIC_KEY |
|
||||
| Short ID | REALITY_SHORT_ID |
|
||||
|
||||
### 方案 B:sing-box 客户端
|
||||
|
||||
1. 下载 [sing-box for Windows](https://github.com/SagerNet/sing-box/releases)
|
||||
2. 将 `client/generated/sing-box-client.json` 放入配置目录
|
||||
3. 以管理员运行(TUN 模式需要),启动后选择 `reality` 出站
|
||||
|
||||
### 方案 C:Nekoray
|
||||
|
||||
1. 下载 [Nekoray](https://github.com/MatsuriDayo/nekoray/releases)
|
||||
2. **Program → Add profile from clipboard**,粘贴 `vless://` 链接
|
||||
3. 右键 → **Start**
|
||||
|
||||
---
|
||||
|
||||
## 三、Android
|
||||
|
||||
### v2rayNG(推荐)
|
||||
|
||||
1. [Google Play](https://play.google.com/store/apps/details?id=com.v2ray.ang) 或 [GitHub Releases](https://github.com/2dust/v2rayNG/releases) 安装
|
||||
2. 右上角 **+** → **从剪贴板导入**(先复制 `vless://` 链接)
|
||||
3. 再导入 `hy2://` 备用节点
|
||||
4. 点击右下角 **V** 连接
|
||||
5. 设置 → **路由设置** → **绕过局域网及大陆地址**
|
||||
|
||||
### sing-box for Android
|
||||
|
||||
1. [GitHub Releases](https://github.com/SagerNet/sing-box/releases) 安装 APK
|
||||
2. **Profiles** → **+** → 导入 `sing-box-client.json`
|
||||
3. 开启 **Service**
|
||||
|
||||
---
|
||||
|
||||
## 四、iOS
|
||||
|
||||
需要美区 Apple ID 或已有购买记录。
|
||||
|
||||
### Shadowrocket(小火箭)
|
||||
|
||||
1. App Store 购买安装 Shadowrocket
|
||||
2. 首页右上角 **+** → **类型选 NONE** → 右上角 **扫描或从剪贴板导入**
|
||||
3. 粘贴 `vless://` 链接,自动填充 Reality 参数
|
||||
4. 再添加 `hy2://` 备用
|
||||
5. 连接后 **连通性测试** 应显示延迟
|
||||
|
||||
**手动添加 Reality:**
|
||||
|
||||
- 类型:VLESS
|
||||
- 地址:VPS IP
|
||||
- 端口:443
|
||||
- UUID:你的 UUID
|
||||
- 传输方式:none
|
||||
- TLS:开启 → 类型 **REALITY**
|
||||
- SNI:REALITY_SERVER_NAME
|
||||
- Public Key / Short ID:从 `.env` 复制
|
||||
- uTLS:chrome
|
||||
- Flow:xtls-rprx-vision
|
||||
|
||||
### Streisand
|
||||
|
||||
1. App Store 安装 Streisand
|
||||
2. **+** → **Import from Clipboard**,粘贴链接
|
||||
3. 连接
|
||||
|
||||
---
|
||||
|
||||
## 五、macOS
|
||||
|
||||
与 Windows 类似:
|
||||
|
||||
- **V2rayU** / **Nekoray** / **sing-box for Apple platforms**
|
||||
- 从剪贴板导入 `vless://` 和 `hy2://` 链接
|
||||
|
||||
---
|
||||
|
||||
## 六、日常使用建议
|
||||
|
||||
1. **默认节点**:Reality(`vless://`)
|
||||
2. **备用节点**:Hysteria2(看视频卡顿时可切换)
|
||||
3. **不要分享**节点链接;每设备保存一份即可
|
||||
4. **每月检查**:`systemctl status sing-box`、证书是否续期(acme.sh 自动)
|
||||
|
||||
---
|
||||
|
||||
## 七、分享链接格式参考
|
||||
|
||||
```
|
||||
vless://UUID@IP:443?encryption=none&flow=xtls-rprx-vision&security=reality&sni=SNI&fp=chrome&pbk=PUBLIC_KEY&sid=SHORT_ID&type=tcp#名称
|
||||
|
||||
hy2://PASSWORD@DOMAIN:8443?sni=DOMAIN#名称
|
||||
```
|
||||
|
||||
完整链接见部署后生成的 `client/generated/share-links.txt`。
|
||||
@@ -0,0 +1,75 @@
|
||||
# 运维与故障排查
|
||||
|
||||
## 服务检查
|
||||
|
||||
```bash
|
||||
# sing-box 是否运行
|
||||
systemctl is-active sing-box
|
||||
|
||||
# 配置语法
|
||||
sing-box check -c /etc/sing-box/config.json
|
||||
|
||||
# 端口监听
|
||||
ss -tlnp | grep 443 # Reality TCP
|
||||
ss -ulnp | grep 8443 # Hysteria2 UDP
|
||||
|
||||
# Nginx fallback
|
||||
curl -s http://127.0.0.1:8080
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
### acme.sh 证书申请失败
|
||||
|
||||
```bash
|
||||
# 确认 DNS 已生效
|
||||
dig +short A your.domain.com
|
||||
|
||||
# 确认 80 端口未被占用(nginx 需先启动)
|
||||
ss -tlnp | grep :80
|
||||
|
||||
# 手动重试
|
||||
/root/.acme.sh/acme.sh --issue -d your.domain.com --nginx --force
|
||||
```
|
||||
|
||||
### sing-box 无法启动
|
||||
|
||||
```bash
|
||||
journalctl -u sing-box -n 50 --no-pager
|
||||
```
|
||||
|
||||
常见原因:证书路径错误、JSON 语法错误、443 被占用。
|
||||
|
||||
### 客户端能连但速度慢
|
||||
|
||||
- 换 Hysteria2 节点(UDP/QUIC 抗丢包)
|
||||
- 检查 VPS 带宽:`wget -O /dev/null http://speedtest.tele2.net/100MB.zip`
|
||||
- 避免高峰时段长时间 4K 流媒体
|
||||
|
||||
### IP 被封
|
||||
|
||||
1. 向 VPS 商申请更换 IP
|
||||
2. 修改 `.env` 中 `REALITY_SERVER_NAME` 为其他大站(如 `www.apple.com`)
|
||||
3. 重新运行 `install.sh` 或手动更新 `/etc/sing-box/config.json` 并 restart
|
||||
|
||||
### 改用 Xray 替代 sing-box(可选)
|
||||
|
||||
若更熟悉 Xray,可使用 `server/xray-server.json.template`:
|
||||
|
||||
```bash
|
||||
# 安装 Xray
|
||||
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
|
||||
|
||||
# 渲染配置
|
||||
sed -e "s|\${UUID}|...|g" ... server/xray-server.json.template > /usr/local/etc/xray/config.json
|
||||
|
||||
systemctl restart xray
|
||||
```
|
||||
|
||||
Hysteria2 仍需单独部署(或使用 sing-box 仅跑 Hy2 inbound)。
|
||||
|
||||
## 安全建议
|
||||
|
||||
- SSH 改用密钥登录,禁用密码:`PermitRootLogin prohibit-password`
|
||||
- 可选修改 SSH 端口,ufw 放行新端口后再删 22
|
||||
- 不要将 `.env` 或 `share-links.txt` 上传到公开仓库
|
||||
Reference in New Issue
Block a user