将 note 笔记库同步到 note_sync,AI_compiler 作为 submodule
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# Gitea 部署指南
|
||||
|
||||
> 2026-08-13 记录。自托管轻量 Git 服务,个人代码仓库,Web 用 Caddy 反代套 HTTPS。域名域名 `git.hyonglin.top`。
|
||||
|
||||
---
|
||||
|
||||
## 选型
|
||||
|
||||
| 方案 | 是否选用 | 原因 |
|
||||
|---|---|---|
|
||||
| **Gitea** | ✅ | Go 单二进制,轻量(~50–100MB),功能全(仓库/Issue/PR/Actions/Package),社区活跃、安全更新及时 |
|
||||
| Gogs | ❌ | Gitea 的 fork 前身,开发停滞,新项目不推荐 |
|
||||
| 裸仓库+SSH | ❌ | 无 Web 界面 |
|
||||
|
||||
> Gitea 是 Gogs 的 fork(社区驱动),新项目无脑选 Gitea;若更在意「纯社区治理」可选 Forgejo。
|
||||
|
||||
---
|
||||
|
||||
## docker-compose 服务
|
||||
|
||||
`silverbullet/docker-compose.yml`:
|
||||
|
||||
```yaml
|
||||
gitea:
|
||||
image: gitea/gitea:latest
|
||||
container_name: gitea
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- GITEA__server__ROOT_URL=https://git.hyonglin.top/
|
||||
- GITEA__server__DOMAIN=git.hyonglin.top
|
||||
- GITEA__server__SSH_DOMAIN=git.hyonglin.top
|
||||
- GITEA__server__SSH_PORT=2222
|
||||
ports:
|
||||
- "2222:22" # SSH clone 用(服务器 22 已被 SSH 占用,故映射 2222)
|
||||
volumes:
|
||||
- ./gitea:/data
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
```
|
||||
|
||||
- Web(3000)不映射端口,由 Caddy 反代 `gitea:3000`
|
||||
- SSH 需映射 `2222:22`,因为宿主机 22 被 OpenSSH 占用
|
||||
|
||||
## Caddy 反代
|
||||
|
||||
`silverbullet/Caddyfile` 加一段:
|
||||
|
||||
```caddyfile
|
||||
# Git 服务
|
||||
git.hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
reverse_proxy gitea:3000
|
||||
}
|
||||
```
|
||||
|
||||
## compose 部署
|
||||
|
||||
```bash
|
||||
docker compose up -d gitea
|
||||
docker compose up -d --force-recreate caddy # 让 caddy 加载新站点
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 首次安装(web 向导)
|
||||
|
||||
打开 `https://git.hyonglin.top` 走安装向导:
|
||||
|
||||
- **数据库**:默认 `SQLite3`(个人用足够)
|
||||
- **域名/URL**:环境变量已预设(`git.hyonglin.top`),保持默认
|
||||
- **SSH 端口**:`2222`
|
||||
- **管理员账号**:设置用户名/邮箱/密码
|
||||
- 点「安装 Gitea」
|
||||
|
||||
验证安装完成:
|
||||
|
||||
```bash
|
||||
# app.ini 应已锁定安装
|
||||
grep INSTALL_LOCK /home/ubuntu/silverbullet/gitea/gitea/conf/app.ini # → true
|
||||
|
||||
# 确认管理员存在
|
||||
docker compose exec -T gitea su git -c "gitea admin user list"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 使用
|
||||
|
||||
- **Web**:登录 `https://git.hyonglin.top` 建仓库
|
||||
- **HTTPS clone**:`git clone https://git.hyonglin.top/用户名/仓库.git`
|
||||
- **SSH clone**:`git clone git@git.hyonglin.top:2222/用户名/仓库.git`(需安全组放行 TCP 2222)
|
||||
- **备份**:备份 `silverbullet/gitea` 目录(含数据库和所有仓库)
|
||||
|
||||
---
|
||||
|
||||
## 相关链接
|
||||
|
||||
- [[主页与Caddy反向代理]] — git.hyonglin.top 的 HTTPS 入口
|
||||
- [[frp内网穿透部署指南]] — 本服务器其他自建服务
|
||||
- [Gitea 官方文档](https://docs.gitea.com/zh-cn/)
|
||||
@@ -0,0 +1,219 @@
|
||||
# Silverbullet 部署指南
|
||||
|
||||
> 2026-08-05 记录。目标:在远程 Linux 服务器上用 Docker 部署自托管笔记服务,实现"随时随地在任意设备用浏览器查看编辑笔记"。
|
||||
|
||||
---
|
||||
|
||||
## 背景与选型
|
||||
|
||||
**需求**:远程服务器部署,随时随地任意设备查看、编辑笔记。
|
||||
|
||||
**选型结论**:Silverbullet(浏览器直接编辑 + Linux/Docker)。
|
||||
|
||||
### 为什么选 Silverbullet
|
||||
|
||||
- 任何设备浏览器打开网址即可**查看 + 编辑**,无需安装 App
|
||||
- 支持 `[[]]` 双链、反向链接(**与 Obsidian 语法兼容**,现有笔记可直接用)
|
||||
- 笔记是纯 Markdown 文件,存在服务器目录,备份 = 复制文件夹
|
||||
- PWA 支持,手机浏览器可离线编辑
|
||||
- Docker 一条命令部署,开源
|
||||
|
||||
### 备选:code-server(VS Code Web)
|
||||
|
||||
如果更想要完整 VS Code 体验,用 codercom/code-server。缺点:移动端体验差、无双链支持。**先用 Silverbullet,不够再补。**
|
||||
|
||||
---
|
||||
|
||||
## 一、服务器部署
|
||||
|
||||
### 创建 docker-compose.yml
|
||||
|
||||
```yaml
|
||||
services:
|
||||
silverbullet:
|
||||
image: ghcr.io/silverbulletmd/silverbullet:latest
|
||||
container_name: silverbullet
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./space:/space # 笔记存储目录,备份就是复制这个文件夹
|
||||
environment:
|
||||
- SB_USER=admin:改成你的强密码 # 登录认证,必填!
|
||||
```
|
||||
|
||||
### 启动
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
访问 `http://服务器IP:3000` → 输入 admin/密码 → 完成。
|
||||
|
||||
### 常用环境变量
|
||||
|
||||
| 变量 | 说明 | 默认 |
|
||||
|---|---|---|
|
||||
| `SB_FOLDER` | Markdown 文件目录 | `/space` |
|
||||
| `SB_PORT` | 内部端口 | `3000` |
|
||||
| `SB_USER` | Basic auth(`user:pass`) | 无认证 |
|
||||
| `SB_AUTH_TOKEN` | Bearer token API 访问 | 无 |
|
||||
| `SB_READ_ONLY` | 只读模式 | `0` |
|
||||
|
||||
---
|
||||
|
||||
## 二、迁移现有笔记
|
||||
|
||||
本机笔记在 `d:\onedrive\note`(Windows),用 Git Bash 一次性传到服务器:
|
||||
|
||||
```bash
|
||||
# 服务器上先建目录
|
||||
ssh user@server "mkdir -p /path/to/space"
|
||||
|
||||
# rsync 上传(排除 Obsidian 配置目录,Silverbullet 用不上)
|
||||
rsync -avP --exclude ".obsidian" "/d/onedrive/note/" user@server:/path/to/space/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 三、HTTPS + 域名(强烈建议)
|
||||
|
||||
裸 HTTP 下密码明文传输,不安全。用 Caddy 做反向代理 + 自动 TLS 证书(Let's Encrypt)。
|
||||
|
||||
### 前提条件
|
||||
|
||||
- 一个已备案/可用的域名,如 `notes.yourdomain.com`
|
||||
- 域名 A 记录已指向服务器公网 IP
|
||||
- 服务器 80 和 443 端口未被占用(云服务器需在安全组放行这两个端口)
|
||||
|
||||
### 整合后的 docker-compose.yml
|
||||
|
||||
将 Caddy 和 Silverbullet 放在同一个 compose 文件中,让它们共享同一个 Docker 网络,容器间用服务名互相访问:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
silverbullet:
|
||||
image: ghcr.io/silverbulletmd/silverbullet:latest
|
||||
container_name: silverbullet
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./space:/space
|
||||
environment:
|
||||
- SB_USER=admin:改成你的强密码
|
||||
# 不暴露 ports,只允许 Caddy 通过内部网络访问
|
||||
|
||||
caddy:
|
||||
image: caddy:latest
|
||||
container_name: caddy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile
|
||||
- caddy_data:/data # 证书和密钥持久化,避免重启重新申请
|
||||
- caddy_config:/config # Caddy 自身配置
|
||||
|
||||
volumes:
|
||||
caddy_data:
|
||||
caddy_config:
|
||||
```
|
||||
|
||||
> **关键**:`caddy_data` 和 `caddy_config` 用 named volume 而非 bind mount,避免权限问题,且证书重启不丢失。
|
||||
|
||||
### Caddyfile 配置
|
||||
|
||||
在 `docker-compose.yml` 同级目录创建 `Caddyfile`(纯文本,无后缀):
|
||||
|
||||
```caddyfile
|
||||
# 基础版:自动 HTTPS + 反向代理
|
||||
notes.yourdomain.com {
|
||||
reverse_proxy silverbullet:3000
|
||||
}
|
||||
```
|
||||
|
||||
**常用增强配置**:
|
||||
|
||||
```caddyfile
|
||||
notes.yourdomain.com {
|
||||
# 反向代理
|
||||
reverse_proxy silverbullet:3000
|
||||
|
||||
# 访问日志(排查问题时打开)
|
||||
log {
|
||||
output file /var/log/caddy/access.log
|
||||
}
|
||||
|
||||
# 限制请求体大小(上传大文件时调大)
|
||||
request_body {
|
||||
max_size 50MB
|
||||
}
|
||||
|
||||
# 安全头(可选)
|
||||
header {
|
||||
X-Content-Type-Options nosniff
|
||||
X-Frame-Options DENY
|
||||
-Server
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 启动与验证
|
||||
|
||||
```bash
|
||||
# 启动
|
||||
docker compose up -d
|
||||
|
||||
# 查看 Caddy 日志(确认证书申请是否成功)
|
||||
docker compose logs caddy -f
|
||||
```
|
||||
|
||||
正常日志中应能看到类似 `certificate obtained successfully` 的输出。然后浏览器访问 `https://notes.yourdomain.com` 即可。
|
||||
|
||||
### 排错
|
||||
|
||||
| 问题 | 检查项 |
|
||||
|---|---|
|
||||
| 证书申请失败 | 确认域名 A 记录已生效(`dig notes.yourdomain.com` 或 `nslookup`),且 80 端口能从公网访问 |
|
||||
| 502 Bad Gateway | `docker compose ps` 确认 silverbullet 容器在运行;确认 Caddyfile 中 `reverse_proxy` 的目标容器名与 compose 中 service 名一致 |
|
||||
| 端口被占用 | 如果服务器已有 nginx/apache,先停掉再启 Caddy,或让 Caddy 监听其他端口 |
|
||||
| 国内服务器 | 80/443 端口需备案;若无备案可用非标端口 + DNS 验证,但 Caddy 默认 HTTP-01 验证仍需 80 端口可达 |
|
||||
|
||||
> 无域名临时方案:frp / 路由侠等内网穿透工具把 3000 端口暴露出去。
|
||||
|
||||
---
|
||||
|
||||
## 四、数据备份
|
||||
|
||||
笔记是纯 Markdown → 备份 = 压缩目录:
|
||||
|
||||
```bash
|
||||
# 手动备份
|
||||
tar czf notes-backup-$(date +%F).tar.gz /path/to/space/
|
||||
|
||||
# cron 定时备份 + 保留最近 7 份
|
||||
0 3 * * * tar czf /backup/notes-$(date +%F).tar.gz /path/to/space/ && ls -t /backup/notes-*.tar.gz | tail -n +8 | xargs rm -f
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 五、使用方式转变(关键)
|
||||
|
||||
选浏览器编辑 → **服务器目录成为唯一权威版本**,本地 OneDrive 降级为离线备份:
|
||||
|
||||
| 场景 | 操作 |
|
||||
|---|---|
|
||||
| 日常编辑 | 浏览器打开 Silverbullet,直接改服务器文件 |
|
||||
| 本地离线备份 | `rsync user@server:/path/to/space/ /d/onedrive/note/` |
|
||||
| 多设备 | 全部走浏览器,无需装任何东西 |
|
||||
|
||||
---
|
||||
|
||||
## 相关链接
|
||||
|
||||
- [[大模型架构基础]] — 本笔记库的正式学习内容
|
||||
- [[AI编译器现状与前景]] — 技术趋势分析
|
||||
|
||||
---
|
||||
|
||||
*最后更新:2026-08-05*
|
||||
@@ -0,0 +1,218 @@
|
||||
# frp 内网穿透部署指南
|
||||
|
||||
> 2026-08-13 更新。目标:通过云服务器(公网 IP `58.87.87.208`)随时随地访问家里多台机器的 SSH 和 RDP,统一用域名 `hyonglin.top` + 端口区分。
|
||||
|
||||
---
|
||||
|
||||
## 背景与方案
|
||||
|
||||
**需求**:家里机器在 NAT 内网、没有公网 IP,想在任意地点 SSH 进去、远程桌面操作。
|
||||
|
||||
**选型结论**:frp(Fast Reverse Proxy),成熟的内网穿透工具。
|
||||
|
||||
- 家里机器(内网)主动反向连到云服务器,云服务器监听公网端口转发进来
|
||||
- 一个服务端(frps)对多个客户端(frpc),加机器只需加端口,服务端不用动
|
||||
- Go 编写,单文件二进制,Linux/Windows 通用,systemd 管理开机自启
|
||||
|
||||
### 架构
|
||||
|
||||
```
|
||||
你(任意地点) 云服务器 frps 家里机器 frpc(可多台)
|
||||
│ │ │
|
||||
├─SSH hyonglin.top:2201──▶│─监听 2201───────────▶│─▶ pc01:22
|
||||
├─SSH hyonglin.top:2202──▶│─监听 2202───────────▶│─▶ pc02:22
|
||||
├─RDP hyonglin.top:3389──▶│─监听 3389───────────▶│─▶ pc01:3389
|
||||
├─RDP hyonglin.top:3390──▶│─监听 3390───────────▶│─▶ pc02:3389
|
||||
│ └─frpc 主动连 bindPort 7000◀─┘
|
||||
```
|
||||
|
||||
> 域名只解析到 IP,**端口才是区分机器的关键**。RDP 不能共用 3389(TCP 层没有域名概念),但 frp 的 `remotePort` 独立于本机 `localPort`,本机 RDP 端口保持 3389 不用改。
|
||||
|
||||
---
|
||||
|
||||
## 端口规划
|
||||
|
||||
| 机器 | SSH(remotePort) | RDP(remotePort) | 本机端口 |
|
||||
|---|---|---|---|
|
||||
| pc01 | 2201 | 3389 | 22 / 3389 |
|
||||
| pc02 | 2202 | 3390 | 22 / 3389 |
|
||||
| 新增机器 | 2203 | 3391 | … |
|
||||
|
||||
固定端口:frps 客户端连接 `7000`、管理面板 `7500`。
|
||||
|
||||
---
|
||||
|
||||
## 一、服务端 frps 部署(云服务器)
|
||||
|
||||
### 下载与安装
|
||||
|
||||
```bash
|
||||
# 下载(GitHub 慢时走镜像 ghfast.top)
|
||||
wget https://ghfast.top/https://github.com/fatedier/frp/releases/download/v0.65.0/frp_0.65.0_linux_amd64.tar.gz
|
||||
tar xzf frp_0.65.0_linux_amd64.tar.gz
|
||||
|
||||
sudo cp frp_0.65.0_linux_amd64/frps /usr/local/bin/
|
||||
sudo mkdir -p /etc/frp
|
||||
```
|
||||
|
||||
### 服务端配置 `/etc/frp/frps.toml`
|
||||
|
||||
```toml
|
||||
bindPort = 7000 # frpc 连接端口
|
||||
auth.token = "0ae2664b411c41645e5c9ab6779724d4" # 客户端认证令牌(frpc 必须一致)
|
||||
|
||||
# 管理面板
|
||||
webServer.addr = "0.0.0.0"
|
||||
webServer.port = 7500
|
||||
webServer.user = "admin"
|
||||
webServer.password = "Admin-0ae2664b"
|
||||
|
||||
# 日志
|
||||
log.to = "/var/log/frps.log"
|
||||
log.level = "info"
|
||||
log.maxDays = 7
|
||||
```
|
||||
|
||||
### systemd 服务 `/etc/systemd/system/frps.service`
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=frp server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/frps -c /etc/frp/frps.toml
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now frps
|
||||
systemctl status frps # active (running)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 二、客户端 frpc 部署(家里机器)
|
||||
|
||||
### 客户端配置 `/etc/frp/frpc.toml`
|
||||
|
||||
以 pc01 为例:
|
||||
|
||||
```toml
|
||||
serverAddr = "hyonglin.top"
|
||||
serverPort = 7000
|
||||
auth.token = "0ae2664b411c41645e5c9ab6779724d4"
|
||||
|
||||
# SSH:服务器 2201 → 本机 22
|
||||
[[proxies]]
|
||||
name = "pc01-ssh"
|
||||
type = "tcp"
|
||||
localIP = "127.0.0.1"
|
||||
localPort = 22
|
||||
remotePort = 2201
|
||||
|
||||
# RDP:服务器 3389 → 本机 3389
|
||||
[[proxies]]
|
||||
name = "pc01-rdp"
|
||||
type = "tcp"
|
||||
localIP = "127.0.0.1"
|
||||
localPort = 3389
|
||||
remotePort = 3389
|
||||
```
|
||||
|
||||
> 加第二台(pc02):把 `name` 换成 `pc02-*`、`remotePort` 换成 `2202`/`3390`,`serverAddr`/`token` 不变即可。
|
||||
|
||||
### 安装(frpc 二进制 + systemd)
|
||||
|
||||
```bash
|
||||
sudo install -m 755 ~/frpc /usr/local/bin/frpc
|
||||
sudo mkdir -p /etc/frp
|
||||
sudo cp ~/frpc.toml /etc/frp/frpc.toml
|
||||
sudo cp ~/frpc.service /etc/systemd/system/frpc.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now frpc
|
||||
systemctl status frpc # active (running)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 三、家里开启 SSH 和 RDP 服务
|
||||
|
||||
### SSH
|
||||
|
||||
```bash
|
||||
sudo apt update && sudo apt install -y openssh-server
|
||||
sudo systemctl enable --now ssh
|
||||
```
|
||||
|
||||
### RDP(Ubuntu 内置,无需装 xrdp)
|
||||
|
||||
- 打开 **设置 → 系统 → 远程桌面**
|
||||
- 开启 **远程登录**(Remote Desktop / RDP)开关,记下用户名密码
|
||||
- 端口默认 3389
|
||||
|
||||
> ⚠️ Ubuntu 内置 RDP 依赖**已登录的图形会话**。重启后停在登录界面、无人登录时 RDP 连不上。若要无人值守,需换 xrdp 方案。
|
||||
|
||||
---
|
||||
|
||||
## 四、云安全组放行端口(关键坑)
|
||||
|
||||
**最容易漏的一步**:云服务商控制台的「防火墙/安全组」默认只开 22/80/443,需手动放行 TCP:
|
||||
|
||||
```
|
||||
7000(frps 连接)、2201/2202(SSH 转发)、3389/3390(RDP 转发)
|
||||
```
|
||||
|
||||
> 服务器内部 `ufw` 是 inactive,iptables 只黑名单了若干恶意 IP,不影响端口;问题出在**云控制台安全组**,与服务器内防火墙无关。
|
||||
|
||||
> 7500(frps 管理面板)走 `frp.hyonglin.top` HTTPS 后,建议在安全组**撤销 7500 的公网放行**,避免明文暴露。
|
||||
|
||||
---
|
||||
|
||||
## 五、验证与使用
|
||||
|
||||
```bash
|
||||
# 服务器端确认 frpc 已登录、代理已监听
|
||||
ss -tlnp | grep -E '2201|2202|3389|3390'
|
||||
sudo tail -f /var/log/frps.log # 应看到 client login / new proxy success
|
||||
```
|
||||
|
||||
连接方式(统一 hyonglin.top + 端口):
|
||||
|
||||
| 目标 | 命令 |
|
||||
|---|---|
|
||||
| pc01 SSH | `ssh 用户名@hyonglin.top -p 2201` |
|
||||
| pc01 RDP | 远程桌面连 `hyonglin.top:3389` |
|
||||
| pc02 SSH | `ssh 用户名@hyonglin.top -p 2202` |
|
||||
| pc02 RDP | 远程桌面连 `hyonglin.top:3390` |
|
||||
|
||||
管理面板:`https://frp.hyonglin.top`(admin / Admin-0ae2664b)
|
||||
|
||||
---
|
||||
|
||||
## 排错记录
|
||||
|
||||
| 症状 | 原因 | 解决 |
|
||||
|---|---|---|
|
||||
| frpc 状态 active 但 frps 日志无 login 记录 | 云安全组没放行 7000 | 控制台放行 7000 及转发端口 |
|
||||
| `login to server failed` | token 不一致 | 检查 frpc/frps 的 auth.token 是否相同 |
|
||||
| 2201 没监听 | frpc 没启动或代理注册失败 | `journalctl -u frpc -n 50` 看报错 |
|
||||
|
||||
---
|
||||
|
||||
## 相关链接
|
||||
|
||||
- [[主页与Caddy反向代理]] — 主页/面板的 HTTPS 入口
|
||||
- [[sshwifty网页SSH终端]] — 浏览器里连 SSH
|
||||
- [[Silverbullet部署指南]] — 本服务器自建服务
|
||||
- [frp官方文档](https://gofrp.org/zh-cn/)
|
||||
|
||||
---
|
||||
|
||||
*最后更新:2026-08-13*
|
||||
@@ -0,0 +1,84 @@
|
||||
# sshwifty 网页 SSH 终端
|
||||
|
||||
> 2026-08-13 记录。网页版通用 SSH 客户端,浏览器里填主机/端口/账号即可连接任意机器。Go 单二进制,内存占用 ~10–30MB。
|
||||
|
||||
---
|
||||
|
||||
## docker-compose 服务
|
||||
|
||||
```yaml
|
||||
sshwifty:
|
||||
image: niruix/sshwifty:latest
|
||||
container_name: sshwifty
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- SSHWIFTY_CONFIG=/etc/sshwifty.conf.json # 指向配置文件
|
||||
volumes:
|
||||
- ./sshwifty.conf.json:/etc/sshwifty.conf.json
|
||||
```
|
||||
|
||||
不暴露端口,由 Caddy 反代 `sshwifty:8182`(WebSocket,Caddy 默认支持),入口 `https://ssh.hyonglin.top`。
|
||||
|
||||
---
|
||||
|
||||
## 配置文件 sshwifty.conf.json(含预设主机)
|
||||
|
||||
```json
|
||||
{
|
||||
"SharedKey": "hylssh0813",
|
||||
"Servers": [
|
||||
{ "ListenInterface": "0.0.0.0", "ListenPort": 8182 }
|
||||
],
|
||||
"Presets": [
|
||||
{
|
||||
"Title": "pc01",
|
||||
"Type": "SSH",
|
||||
"Host": "hyonglin.top:2201",
|
||||
"Meta": { "User": "ylhan", "Encoding": "utf-8", "Authentication": "Password" }
|
||||
},
|
||||
{
|
||||
"Title": "pc02",
|
||||
"Type": "SSH",
|
||||
"Host": "hyonglin.top:2202",
|
||||
"Meta": { "User": "ylhan", "Encoding": "utf-8", "Authentication": "Password" }
|
||||
},
|
||||
{
|
||||
"Title": "云服务器",
|
||||
"Type": "SSH",
|
||||
"Host": "hyonglin.top:22",
|
||||
"Meta": { "User": "ubuntu", "Encoding": "utf-8", "Authentication": "Password" }
|
||||
}
|
||||
],
|
||||
"OnlyAllowPresetRemotes": false
|
||||
}
|
||||
```
|
||||
|
||||
> 端口写在 `Host` 里用 `host:port`,没有单独的 Port 字段。`OnlyAllowPresetRemotes: true` 可限制只连预设主机。改完配置 `docker compose up -d sshwifty` 重启生效。
|
||||
|
||||
---
|
||||
|
||||
## 使用
|
||||
|
||||
1. 打开 `https://ssh.hyonglin.top`,输入 SharedKey 密码
|
||||
2. 预设主机点一下即连,也可手动填任意主机:
|
||||
|
||||
| 预设 | 目标 |
|
||||
|---|---|
|
||||
| pc01 | `hyonglin.top:2201` |
|
||||
| pc02 | `hyonglin.top:2202` |
|
||||
| 云服务器 | `hyonglin.top:22` |
|
||||
|
||||
---
|
||||
|
||||
## 坑:Known Remotes 不跨设备
|
||||
|
||||
Known Remotes(已知主机)存在浏览器 `localStorage`,换机器/换浏览器/清缓存都会丢,**没有服务端存储**。
|
||||
|
||||
要跨设备固定入口,就用上面的 **Presets**(服务端配置,所有机器通用)。
|
||||
|
||||
---
|
||||
|
||||
## 相关链接
|
||||
|
||||
- [[frp内网穿透部署指南]] — SSH/RDP 端口转发
|
||||
- [[主页与Caddy反向代理]] — ssh.hyonglin.top 的 HTTPS 入口
|
||||
@@ -0,0 +1,127 @@
|
||||
# 主页与 Caddy 反向代理
|
||||
|
||||
> 2026-08-13 记录。用 Caddy 给自建服务套 HTTPS,并做一个主页统一列出服务链接。域名都在 Cloudflare 管理,用 DNS challenge 自动签证书。
|
||||
|
||||
---
|
||||
|
||||
## 域名规划
|
||||
|
||||
所有域名 A 记录统一指向 `58.87.87.208`:
|
||||
|
||||
| 域名 | 用途 |
|
||||
|---|---|
|
||||
| `hyonglin.top` | 主页(导航)+ SSH/RDP 直连(纯 DNS 不经 Caddy) |
|
||||
| `www.hyonglin.top` | 301 重定向到 hyonglin.top |
|
||||
| `note.hyonglin.top` | 笔记 Silverbullet |
|
||||
| `frp.hyonglin.top` | frp 管理面板 |
|
||||
| `ssh.hyonglin.top` | 网页 SSH 终端 |
|
||||
| `git.hyonglin.top` | Git 服务(Gitea) |
|
||||
|
||||
---
|
||||
|
||||
## 主页
|
||||
|
||||
静态页 `silverbullet/homepage/index.html`,导航分「自建服务」「常用链接」两组;以后加服务在 `<ul class="links">` 里加一行即可(目录挂载,改完实时生效)。
|
||||
|
||||
---
|
||||
|
||||
## Caddyfile
|
||||
|
||||
`silverbullet/Caddyfile`:
|
||||
|
||||
```caddyfile
|
||||
# www → 主域名 301
|
||||
www.hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
redir https://hyonglin.top{path} 301
|
||||
}
|
||||
|
||||
# 主页
|
||||
hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
root * /srv/homepage
|
||||
file_server
|
||||
}
|
||||
|
||||
# frp 管理面板
|
||||
frp.hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
reverse_proxy host.docker.internal:7500
|
||||
}
|
||||
|
||||
# 笔记
|
||||
note.hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
reverse_proxy silverbullet:3000
|
||||
}
|
||||
|
||||
# 网页 SSH 终端
|
||||
ssh.hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
reverse_proxy sshwifty:8182
|
||||
}
|
||||
|
||||
# Git 服务
|
||||
git.hyonglin.top {
|
||||
tls {
|
||||
dns cloudflare {env.CF_API_TOKEN}
|
||||
}
|
||||
reverse_proxy gitea:3000
|
||||
}
|
||||
|
||||
# 备案期间 IP 直连主页(HTTP,非标端口绕过备案拦 80/443)
|
||||
:8080 {
|
||||
root * /srv/homepage
|
||||
file_server
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## compose 关键改动
|
||||
|
||||
Caddy 在 Docker 里,要访问宿主机上的 frps(7500),需加 `extra_hosts`;主页则挂载目录:
|
||||
|
||||
```yaml
|
||||
caddy:
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway" # 让容器访问宿主机 frps:7500
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile
|
||||
- ./homepage:/srv/homepage # 主页静态文件
|
||||
```
|
||||
|
||||
改完 `docker compose up -d` 重建 Caddy,证书自动签发(DNS challenge)。frps 面板仍保留自身 basic auth,HTTPS + 面板认证双重保护。
|
||||
|
||||
主页导航:`silverbullet/homepage/index.html`,分「自建服务」「常用链接」两组;加服务在 `<ul class="links">` 里加一行。
|
||||
|
||||
---
|
||||
|
||||
## 坑:单文件 bind mount
|
||||
|
||||
Caddyfile 是**单文件 bind mount**,用编辑器「重命名替换」改完后容器内不生效(inode 变化),必须重建:
|
||||
|
||||
```bash
|
||||
docker compose up -d --force-recreate caddy
|
||||
```
|
||||
|
||||
(主页 index.html 是**目录挂载**,改完实时生效,无需重建。)
|
||||
|
||||
---
|
||||
|
||||
## 相关链接
|
||||
|
||||
- [[frp内网穿透部署指南]] — frp 端口与转发
|
||||
- [[Gitea部署指南]] — git.hyonglin.top 后端
|
||||
- [[sshwifty网页SSH终端]] — ssh.hyonglin.top 后端
|
||||
- [[Silverbullet部署指南]] — note.hyonglin.top 后端
|
||||
Reference in New Issue
Block a user