# Nginx Proxy Manager (192.168.42.124) 家用反向代理閘道。所有對外網域先進到這台,再轉到內網各服務。 - **主機**:`192.168.42.124`,部署路徑 `/opt/nginx-proxy-manager` - **管理介面**:http://192.168.42.124:81 或 https://ngx-proxy-mgr.lotimmy.com - **版本**:NPM 2.15.1(image `jc21/nginx-proxy-manager:latest`,2026-06-03 建立) - **狀態**:容器 `nginxproxymanager` 已連續運行 5 週,佔用 80 / 81 / 443 > 本文件為 2026-08-01 的現況快照,資料來自主機上的 `docker-compose.yml` 與 `data/database.sqlite`。 ## 部署 `docker-compose.yml`(單一服務): | 項目 | 設定 | |---|---| | image | `jc21/nginx-proxy-manager:latest` | | container_name | `nginxproxymanager` | | restart | `unless-stopped` | | ports | `80:80`、`443:443`、`81:81` | | volumes | `./data:/data`、`./letsencrypt:/etc/letsencrypt` | | env | `TZ=Asia/Taipei`(`DISABLE_IPV6` 已註解保留) | | dns | `8.8.8.8`、`1.1.1.1` | | labels | `com.centurylinklabs.watchtower.enable=true`(watchtower 自動更新) | 目錄裡的 `Makefile` 包好了常用指令,專案名自動取當前資料夾名: ```bash make up # 背景啟動 make down # 停止並移除容器 make restart # 重啟 make logs # tail -f 最後 100 行 make ps # 服務狀態 make exec # 進入 app 容器 shell make clean # 連 volume 一起清掉(危險) ``` ## 資料 ``` /opt/nginx-proxy-manager/ ├── docker-compose.yml ├── Makefile ├── data/ # 193M │ ├── database.sqlite # 所有設定都在這 │ ├── database.sqlite.bak-2026-04-18 │ ├── keys.json # JWT 金鑰,遺失等於所有 session 失效 │ ├── nginx/ # NPM 產生的 conf(proxy_host / dead_host / stream / …) │ ├── custom_ssl/ access/ logs/ letsencrypt-acme-challenge/ └── letsencrypt/ # 7.4M,Let's Encrypt 憑證本體 ``` 備份只要打包 `data/` 與 `letsencrypt/` 兩個目錄即可完整還原。目前只有一份 2026-04-18 的手動 DB 備份,**沒有排程備份**。 ## 物件統計 | 類型 | 數量 | |---|---| | Proxy Host | 36(全部啟用) | | Certificate | 40(全為 Let's Encrypt) | | Dead Host | 2(`*.lotimmy.com`、`125.229.110.50`) | | Access List | 1(`Protect PACS`) | | Redirection Host / Stream | 0 | | User | 1 | ## Proxy Host 一覽 旗標說明:`cache` 快取、`block` block common exploits、`ws` websocket upgrade、`h2` HTTP/2。 | 網域 | 轉發目標 | SSL | 旗標 | |---|---|---|---| | bark.lotimmy.com | http://192.168.42.116:8080 | SSL | block ws h2 | | codimd.lotimmy.com | http://192.168.42.120:30921 | 強制 | h2 | | dicom-server.lotimmy.com | http://192.168.42.124:60606 | SSL | block ws | | drawnix.timmy.edu.kg | http://192.168.42.124:40000 | SSL | block ws h2 | | headscale.lotimmy.com | http://192.168.42.126:8080 | SSL | cache block ws h2 | | hoarder.lotimmy.com | http://192.168.42.124:3000 | SSL | block ws h2 | | httpbin.lotimmy.com | http://192.168.42.120:30921 | SSL | cache block ws h2 | | ip.lotimmy.com | http://192.168.42.105:8080 | SSL | block ws h2 | | lyd-biz.lotimmy.com | http://192.168.42.117:5000 | SSL | block ws h2 | | lyd-biz-test.lotimmy.com | http://192.168.42.115:5000 | SSL | block ws h2 | | mailpit.lotimmy.com | http://192.168.42.107:8025 | SSL | block ws h2 | | myspeed.timmy.edu.kg | http://192.168.42.124:5216 | SSL | ws h2 | | n8n.lotimmy.com | http://192.168.42.103:5678 | SSL | block ws h2 | | netbird.timmy.us.kg | http://192.168.42.127:80 | 強制 | block ws h2 | | ngx-proxy-mgr.lotimmy.com | http://192.168.42.124:81 | SSL | block ws h2 | | noco.timmy.edu.kg | http://192.168.42.124:28080 | SSL | cache block ws h2 | | ollama.lotimmy.com | http://100.64.0.30:11434 | SSL | — | | opengist.lotimmy.com | http://192.168.42.120:30921 | 強制 | block ws h2 | | openwrt.lotimmy.com | http://192.168.42.10:80 | SSL | cache block ws h2 | | pacs.lotimmy.com | http://192.168.42.124:8042 | SSL | block ws | | pb.lotimmy.com | http://192.168.42.124:18090 | 強制 | block ws h2 | | pbs.lotimmy.com | https://192.168.42.30:8007 | 強制 | block ws | | pdf.lotimmy.com | http://192.168.42.109:8080 | SSL | block ws h2 | | picsur.lotimmy.com | http://192.168.42.124:8080 | SSL | cache block ws h2 | | pogo-viewer.timmy.us.kg | http://192.168.42.108:8028 | SSL | cache block ws h2 | | poke-api.lotimmy.com | http://192.168.42.108:8008 | SSL | block | | prompt-opt.lotimmy.com | http://192.168.42.124:8082 | SSL | block ws | | pve.lotimmy.com | https://192.168.42.38:8006 | 強制 | block ws h2 | | registry.lotimmy.com | http://192.168.42.124:5000 | SSL | block ws | | registry-ui.lotimmy.com | http://192.168.42.124:8081 | SSL | — | | syno.lotimmy.com | https://192.168.42.20:5001 | 強制 | block ws h2 | | tinyauth.lotimmy.com | http://192.168.42.124:3005 | 強制 | ws h2 | | tinyauth.timmy.edu.kg | http://192.168.42.124:3006 | 強制 | ws h2 | | ucapi.timmy.edu.kg | http://192.168.42.108:16888 | SSL | block ws h2 | | vaultwarden.lotimmy.com | http://192.168.42.120:30921 | 強制 | ws h2 | | web.lotimmy.com | http://192.168.42.104:80 | SSL | block ws h2 | ### 後端主機分布 | 後端 | 用途 | |---|---| | `192.168.42.124`(本機) | 11 個服務:dicom-server、drawnix、hoarder、myspeed、noco、pacs、pb、picsur、prompt-opt、registry(+ui)、tinyauth ×2、NPM 自己 | | `192.168.42.120:30921` | 4 個網域共用(K8s NodePort):codimd、httpbin、opengist、vaultwarden | | `192.168.42.108` | poke-api、pogo-viewer、ucapi | | `192.168.42.30` / `.38` / `.20` | PBS / PVE / Synology(皆為 https 後端) | | `100.64.0.30` | ollama,走 Tailscale/Headscale 網段 | ## 憑證 40 張全部由 Let's Encrypt 簽發。以到期日排序,需要注意的是前段: | 憑證 | 到期日 | 狀況 | |---|---|---| | ~~typebot.lotimmy.com~~ | 2025-10-02 | 2026-08-01 已刪除(DB + certbot) | | myip.lotimmy.com | 2026-02-09 | **已過期**,無對應 proxy host | | pangolin.timmy.edu.kg | 2026-02-22 | **已過期**,無對應 proxy host | | minio.lotimmy.com | 2026-05-28 | **已過期**,無對應 proxy host | | ~~jsbin.timmy.edu.kg~~ | 2026-08-09 | 2026-08-01 已刪除(DB + certbot) | | auth.lotimmy.com | 2026-08-20 | 無對應 proxy host | | mailpit.lotimmy.com | 2026-09-01 | 使用中 | | …其餘 35 張 | 2026-09 ~ 2026-10 | 使用中,正常續期 | `letsencrypt/live/` 底下有 `npm-1` ~ `npm-87` 的斷號目錄,部分帶 `-0001` 後綴(同網域重簽產生的新 lineage)。舊 lineage 不會自動清掉,目錄數量比實際憑證多屬正常。 ## 待辦 / 觀察 - **剩 4 張孤兒憑證**(myip、pangolin、minio、auth)已無 proxy host 使用,其中 3 張過期。可在 UI 的 SSL Certificates 刪掉。 - **沒有自動備份**。`data/` + `letsencrypt/` 打包丟到別台就夠,目前有 2026-04-18 與 2026-08-01 兩份手動 DB 備份。 - **watchtower 自動更新已開啟** 且 image tag 是 `latest`,NPM 大版本更新會直接套用,DB migration 失敗時沒有回退點——這是上一點更要緊的原因。 - **單點故障**:36 個網域全靠這台,其中 11 個服務也跑在同一台上。 - `dead_host` 有 `*.lotimmy.com` 泛用攔截,未定義的子網域會落到這裡,不會外洩到預設站台。