Files
termi-blog/deploy/caddy/Caddyfile.tohka.production.example

44 lines
1.2 KiB
Caddyfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 直接粘到 tohka 宿主机大 Caddyfile 里的推荐块
# 前提:
# 1. 已存在 import common / import tinyauth 片段
# 2. docker compose 使用 compose.tohka.override.yml把容器端口绑到 127.0.0.1
# 3. 环境里已设置:
# TERMI_ADMIN_PROXY_SHARED_SECRET=<随机长字符串>
blog.init.cool {
import common
reverse_proxy http://127.0.0.1:4321
}
admin.blog.init.cool {
import common
import tinyauth
# 后台 API受 TinyAuth 保护,并附带后端共享密钥
handle /api/* {
reverse_proxy http://127.0.0.1:5150 {
header_up X-Termi-Proxy-Secret {$TERMI_ADMIN_PROXY_SHARED_SECRET}
}
}
# 后台静态资源 / SPA
handle {
reverse_proxy http://127.0.0.1:4322
}
}
# 前台公开 API评论 / 搜索 / AI 问答 / 订阅管理)
api.blog.init.cool {
import common
reverse_proxy http://127.0.0.1:5150
}
# 对应 deploy/docker/.env 关键项:
# APP_BASE_URL=https://admin.blog.init.cool
# PUBLIC_API_BASE_URL=https://api.blog.init.cool
# ADMIN_API_BASE_URL=https://admin.blog.init.cool
# ADMIN_FRONTEND_BASE_URL=https://blog.init.cool
# TERMI_ADMIN_TRUST_PROXY_AUTH=true
# TERMI_ADMIN_LOCAL_LOGIN_ENABLED=false
# TERMI_ADMIN_PROXY_SHARED_SECRET=<随机长字符串>