Files
JianMiauandClaude Opus 5 ae3221c460 移除 app 容器的對外埠,對外只保留 nginx 的 HTTPS 入口
摘要:
360-player 服務改為只 expose 不 ports,明文 HTTP 不再離開容器內網,
對外入口只剩 360-player-web 的 8443。

根本原因:
先前為了讓區網能用 IP 免憑證警告直連,保留了 app 的 ${PORT}:8360 對外映射。
但該埠在路由器上也有對外轉發,實際使用時是以網域連線
(http://jianmiau.tk:8360),等於在外網留了一條明文路徑。

影響:
外網走 8360 時,影片內容與 API 全程未加密,加上 TLS 的意義被抵消。

修法:
- docker-compose.yml 拿掉 360-player 的 ports,只留 expose: 8360;
  nginx 仍可經容器內網以服務名連到它
- 保留註解說明如何加回來,並註明要綁死區網介面而非 0.0.0.0
- .env / .env.example 移除不再被 compose 參照的 PORT
- README 的 SSL 段落改寫,說明代價是區網也要用網域連

驗證:
docker compose config 展開後只有一個 published port(8443 → 8443),
360-player 服務底下僅剩 expose。

備註:路由器上 8360 的 port forwarding 需另外手動關閉,僅改 compose 不足以關掉外網入口。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 15:01:56 +08:00

29 lines
1.0 KiB
Bash
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.
# 複製成 .env 後依 NAS 實際路徑修改;docker compose 會自動讀取 .env
# 影片資料夾在 NAS 上的路徑(會以唯讀方式掛進容器的 /videos)
VIDEO_DIR=/volume1/photo/Badminton
# 轉檔輸出與快取的存放位置(容器的 /cache;每部影片三種畫質約需原檔 70% 的空間)
CACHE_DIR=/volume1/docker/360_player/cache
# HTTPS 埠(由 nginx 容器終結 TLS 後轉給 app)。
# app 容器不對外開埠,對外只有這一個入口。
HTTPS_PORT=8443
# 時區
TZ=Asia/Taipei
# CPU 轉檔的 libx264 presetveryfast(預設)/ superfast / ultrafast
X264_PRESET=veryfast
# --- SSL ---
# 憑證放的資料夾(唯讀掛進 nginx 容器的 /etc/nginx/certs)。
# DSM 續期後直接覆蓋這裡的檔案即可,nginx 會自己 reload,不用重開容器。
SSL_CERT_DIR=/volume1/docker/certs
SSL_CERT_FILE_NAME=cert.pem
SSL_CHAIN_FILE_NAME=chain.pem
SSL_KEY_FILE_NAME=privkey.pem
# 憑證上的網域;用 _ 表示不限(任何 Host 都接)
NGINX_SERVER_NAME=jianmiau.tk