İçeriğe geç

Docker Traefik Kurulum

# yml
version: '3'

volumes:
  traefik-ssl-certs:
    driver: local

services:
  traefik:
    image: "traefik:v2.5"
    container_name: "traefik"
    ports:
      - "80:80"
      - "443:443"
      # (Optional) Expose Dashboard
      - "8080:8080"  # Don't do this in production!
    volumes:
      - /etc/traefik:/etc/traefik
      - traefik-ssl-certs:/ssl-certs
      - /var/run/docker.sock:/var/run/docker.sock:ro
#/etc/traefik/traefik.yml

global:
  checkNewVersion: true
  sendAnonymousUsage: false  # true by default

# (Optional) Log information
# ---
#log:
#  level: DEBUG  # DEBUG, INFO, WARNING, ERROR, CRITICAL
#   format: common  # common, json, logfmt
#   filePath: /var/log/traefik/traefik.log

# (Optional) Accesslog
# ---
# accesslog:
  # format: common  # common, json, logfmt
  # filePath: /var/log/traefik/access.log

# (Optional) Enable API and Dashboard
# ---
api:
  dashboard: true  # true by default
  insecure: true  # Don't do this in production!

# Entry Points configuration
# ---
entryPoints:
  web:
    address: :80
    # (Optional) Redirect to HTTPS
    # ---
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https

  websecure:
    address: :443

# Certificates configuration
# ---
# TODO: Custmoize your Cert Resolvers and Domain settings
# 
certificatesResolvers:
# LET'S ENCRYPT:
# ---
# 
  staging:
    acme:
      email: [email protected]  # TODO: Change this to your email
      storage: /ssl-certs/acme.json
      caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
      httpChallenge:
        entryPoint: web
  production:
    acme:
      email: [email protected]  # TODO: Change this to your email
      storage: /ssl-certs/acme.json
      caServer: "https://acme-v02.api.letsencrypt.org/directory"
      httpChallenge:
        entryPoint: web

# Provider Configuration
# ---
# TODO: Customize your Provider Settings if needed
# 
providers:
# DOCKER:
# ---
#
  docker:
    exposedByDefault: false  # Default is true
# herhangi bir container ile traefik i bağlamak için

  #Nginx Service
  webserver:
    image: nginx:alpine
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.dbotgulsum.entrypoints=websecure"
      - "traefik.http.routers.dbotgulsum.rule=Host(`domain.com`)"
      - "traefik.http.routers.dbotgulsum.tls=true"
      - "traefik.http.routers.dbotgulsum.tls.certresolver=production"
      - "traefik.http.services.dbotgulsum.loadbalancer.server.port=80"
Tarih:Genel

İlk Yorumu Siz Yapın

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir