将 note 笔记库同步到 note_sync,AI_compiler 作为 submodule
This commit is contained in:
@@ -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