From 3ca39d57d0eb437d8ef0d99edf7538f21ea1496b Mon Sep 17 00:00:00 2001 From: Jeffery Date: Tue, 9 Jun 2026 22:57:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Service=EF=BC=9ATraefik?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service%EF%BC%9ATraefik.md | 165 +++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) diff --git a/Service%EF%BC%9ATraefik.md b/Service%EF%BC%9ATraefik.md index 32bea10..4621c31 100644 --- a/Service%EF%BC%9ATraefik.md +++ b/Service%EF%BC%9ATraefik.md @@ -44,4 +44,169 @@ systemctl daemon-reload && systemctl enable traefik.service && systemctl start t ```bash systemctl stop traefik.service && systemctl disable traefik.service && rm /etc/systemd/system/traefik.service +``` + +範例設定檔 + +```bash +nano /root/traefik.toml +``` + +```toml +################################################################ +# +# Configuration sample for Traefik v2. +# +# For Traefik v1: https://github.com/traefik/traefik/blob/v1.7/traefik.sample.toml +# +################################################################ + +################################################################ +# Global configuration +################################################################ +[global] + checkNewVersion = true + sendAnonymousUsage = true + +################################################################ +# Entrypoints configuration +################################################################ + +# Entrypoints definition +# +# Optional +# Default: +[entryPoints] + [entryPoints.web] + address = ":80" + + [entryPoints.websecure] + address = ":443" + +################################################################ +# Traefik logs configuration +################################################################ + +# Traefik logs +# Enabled by default and log to stdout +# +# Optional +# +[log] + + # Log level + # + # Optional + # Default: "ERROR" + # + # level = "DEBUG" + + # Sets the filepath for the traefik log. If not specified, stdout will be used. + # Intermediate directories are created if necessary. + # + # Optional + # Default: os.Stdout + # + # filePath = "log/traefik.log" + + # Format is either "json" or "common". + # + # Optional + # Default: "common" + # + # format = "json" + +################################################################ +# Access logs configuration +################################################################ + +# Enable access logs +# By default it will write to stdout and produce logs in the textual +# Common Log Format (CLF), extended with additional fields. +# +# Optional +# +# [accessLog] + + # Sets the file path for the access log. If not specified, stdout will be used. + # Intermediate directories are created if necessary. + # + # Optional + # Default: os.Stdout + # + # filePath = "/path/to/log/log.txt" + + # Format is either "json", "common", or "genericCLF". + # - "common": Traefik's extended CLF format (default) + # - "genericCLF": Standard CLF format compatible with standard log analyzers + # - "json": JSON format for structured logging + # + # Optional + # Default: "common" + # + # format = "json" + # format = "genericCLF" + +################################################################ +# API and dashboard configuration +################################################################ + +# Enable API and dashboard +[api] + + # Enable the API in insecure mode + # + # Optional + # Default: false + # + # insecure = true + + # Enabled Dashboard + # + # Optional + # Default: true + # + # dashboard = false + +################################################################ +# Ping configuration +################################################################ + +# Enable ping +[ping] + + # Name of the related entry point + # + # Optional + # Default: "traefik" + # + # entryPoint = "traefik" + +################################################################ +# Docker configuration backend +################################################################ + +# Enable Docker configuration backend +[providers.docker] + + # Docker server endpoint. Can be a tcp or a unix socket endpoint. + # + # Required + # Default: "unix:///var/run/docker.sock" + # + # endpoint = "tcp://10.10.10.10:2375" + + # Default host rule. + # + # Optional + # Default: "Host(`{{ normalize .Name }}`)" + # + # defaultRule = "Host(`{{ normalize .Name }}.docker.localhost`)" + + # Expose containers by default in traefik + # + # Optional + # Default: true + # + # exposedByDefault = false ``` \ No newline at end of file