feat: 對齊註解,加上記憶體限制
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# ===============================================================
|
||||
# 服務描述: Traefik 反向代理與負載平衡器
|
||||
# 建立日期: 2025-10-23
|
||||
# 更新日期: 2025-10-23
|
||||
# 更新日期: 2026-01-21
|
||||
# 版本: latest
|
||||
# 網路連接埠: 80 (HTTP), 443 (HTTPS)
|
||||
# 管理介面: traefik.jsc.idv.me
|
||||
@@ -17,6 +17,9 @@ services:
|
||||
image: traefik:latest
|
||||
container_name: traefik_server
|
||||
|
||||
# === 資源限制 ===
|
||||
mem_limit: 512m # 記憶體限制 512MB
|
||||
|
||||
# === 網路連接埠對應 ===
|
||||
ports:
|
||||
- "80:80" # HTTP 連接埠
|
||||
@@ -29,38 +32,38 @@ services:
|
||||
- "traefik.docker.network=traefik_vlan" # 指定網路
|
||||
|
||||
# --- HTTP 壓縮中介軟體 ---
|
||||
- "traefik.http.middlewares.gzip.compress=true"
|
||||
- "traefik.http.middlewares.gzip.compress=true" # 啟用 GZIP 壓縮
|
||||
|
||||
# --- Basic Auth 中介軟體 (共用) ---
|
||||
- "traefik.http.middlewares.auth.basicauth.users=jiantw83:$$apr1$$u.VU3c6O$$AfAxvklBJ4lelZw07o2g20"
|
||||
- "traefik.http.middlewares.auth.basicauth.users=jiantw83:$$apr1$$u.VU3c6O$$AfAxvklBJ4lelZw07o2g20" # 使用者: jiantw83
|
||||
|
||||
# --- HTTP 重導向中介軟體 ---
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true"
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https" # 重導向至 HTTPS
|
||||
- "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true" # 永久重導向 (301)
|
||||
|
||||
# --- Traefik 儀表板 HTTP 路由 ---
|
||||
- "traefik.http.routers.traefik-dashboard.entrypoints=http"
|
||||
- "traefik.http.routers.traefik-dashboard.rule=Host(`traefik.jsc.idv.me`)"
|
||||
- "traefik.http.routers.traefik-dashboard.middlewares=https-redirect@docker"
|
||||
- "traefik.http.routers.traefik-dashboard.entrypoints=http" # 監聽 HTTP
|
||||
- "traefik.http.routers.traefik-dashboard.rule=Host(`traefik.jsc.idv.me`)" # 主機名稱規則
|
||||
- "traefik.http.routers.traefik-dashboard.middlewares=https-redirect@docker" # 套用 HTTPS 重導向
|
||||
|
||||
# --- Traefik 儀表板 HTTPS 路由 ---
|
||||
- "traefik.http.routers.traefik-dashboard-tls.entrypoints=https"
|
||||
- "traefik.http.routers.traefik-dashboard-tls.rule=Host(`traefik.jsc.idv.me`)"
|
||||
- "traefik.http.routers.traefik-dashboard-tls.middlewares=gzip@docker"
|
||||
- "traefik.http.routers.traefik-dashboard-tls.service=dashboard@internal"
|
||||
- "traefik.http.routers.traefik-dashboard-tls.tls=true"
|
||||
- "traefik.http.routers.traefik-dashboard-tls.entrypoints=https" # 監聽 HTTPS
|
||||
- "traefik.http.routers.traefik-dashboard-tls.rule=Host(`traefik.jsc.idv.me`)" # 主機名稱規則
|
||||
- "traefik.http.routers.traefik-dashboard-tls.middlewares=gzip@docker" # 套用壓縮中介軟體
|
||||
- "traefik.http.routers.traefik-dashboard-tls.service=dashboard@internal" # 使用內建儀表板服務
|
||||
- "traefik.http.routers.traefik-dashboard-tls.tls=true" # 啟用 TLS
|
||||
|
||||
# --- Traefik API HTTP 路由 ---
|
||||
- "traefik.http.routers.traefik-dashboard-api.entrypoints=http"
|
||||
- "traefik.http.routers.traefik-dashboard-api.rule=Host(`traefik.jsc.idv.me`)"
|
||||
- "traefik.http.routers.traefik-dashboard-api.middlewares=https-redirect@docker"
|
||||
- "traefik.http.routers.traefik-dashboard-api.entrypoints=http" # 監聽 HTTP
|
||||
- "traefik.http.routers.traefik-dashboard-api.rule=Host(`traefik.jsc.idv.me`)" # 主機名稱規則
|
||||
- "traefik.http.routers.traefik-dashboard-api.middlewares=https-redirect@docker" # 套用 HTTPS 重導向
|
||||
|
||||
# --- Traefik API HTTPS 路由 ---
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.entrypoints=https"
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.rule=Host(`traefik.jsc.idv.me`) && PathPrefix(`/api`)"
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.middlewares=gzip@docker"
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.service=api@internal"
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.tls=true"
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.entrypoints=https" # 監聽 HTTPS
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.rule=Host(`traefik.jsc.idv.me`) && PathPrefix(`/api`)" # 主機名稱 + 路徑規則
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.middlewares=gzip@docker" # 套用壓縮中介軟體
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.service=api@internal" # 使用內建 API 服務
|
||||
- "traefik.http.routers.traefik-dashboard-api-tls.tls=true" # 啟用 TLS
|
||||
|
||||
# === 環境變數設定 ===
|
||||
environment:
|
||||
|
||||
Reference in New Issue
Block a user