移除 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>
This commit is contained in:
+4
-4
@@ -6,10 +6,10 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
image: 360-player:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
# 區網用 IP 直連的 HTTP(憑證是網域名,IP 連一定會跳警告,所以留一條明文)。
|
||||
# 想只走 HTTPS 的話把這兩行刪掉,改用下面的 expose 就好。
|
||||
- "${PORT:-8360}:8360"
|
||||
# 不對外開埠:只透過容器內網讓 nginx 連得到,外面一律走 HTTPS。
|
||||
# 若要在區網用 IP 直連明文(會省掉憑證警告),自行加回:
|
||||
# ports:
|
||||
# - "127.0.0.1:${PORT:-8360}:8360" # 或綁區網 IP
|
||||
expose:
|
||||
- "8360"
|
||||
volumes:
|
||||
|
||||
Reference in New Issue
Block a user