60 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			YAML
		
	
	
	
# Traefik 配置文件
 | 
						||
api:
 | 
						||
  dashboard: true
 | 
						||
  insecure: true  # 仅开发环境,生产环境请使用 HTTPS
 | 
						||
 | 
						||
# 入口点配置
 | 
						||
entryPoints:
 | 
						||
  web:
 | 
						||
    address: ":80"
 | 
						||
  websecure:
 | 
						||
    address: ":443"
 | 
						||
 | 
						||
# 提供者配置
 | 
						||
providers:
 | 
						||
  # Docker 标签发现
 | 
						||
  docker:
 | 
						||
    endpoint: "unix:///var/run/docker.sock"
 | 
						||
    exposedByDefault: false
 | 
						||
    watch: true
 | 
						||
 | 
						||
  # Consul 服务发现
 | 
						||
  consul:
 | 
						||
    endpoints:
 | 
						||
      - "consul1:8500"
 | 
						||
      - "consul2:8500"
 | 
						||
      - "consul3:8500"
 | 
						||
    watch: true
 | 
						||
    
 | 
						||
  # 文件配置提供者
 | 
						||
  file:
 | 
						||
    filename: /etc/traefik/dynamic.yml
 | 
						||
    watch: true
 | 
						||
 | 
						||
# 证书解析器(Let's Encrypt)
 | 
						||
certificatesResolvers:
 | 
						||
  letsencrypt:
 | 
						||
    acme:
 | 
						||
      email: admin@example.com
 | 
						||
      storage: /certs/acme.json
 | 
						||
      httpChallenge:
 | 
						||
        entryPoint: web
 | 
						||
 | 
						||
# 日志配置
 | 
						||
log:
 | 
						||
  level: INFO
 | 
						||
  filePath: "/var/log/traefik.log"
 | 
						||
 | 
						||
accessLog:
 | 
						||
  filePath: "/var/log/access.log"
 | 
						||
 | 
						||
# 指标配置
 | 
						||
metrics:
 | 
						||
  prometheus:
 | 
						||
    addEntryPointsLabels: true
 | 
						||
    addServicesLabels: true
 | 
						||
 | 
						||
# 全局配置
 | 
						||
global:
 | 
						||
  checkNewVersion: false
 | 
						||
  sendAnonymousUsage: false |