Traefik service proxy

Submitted by Erik Wegner on
Body

Any recent server is powerful enough to host several web applications. Those applications are usually behind a proxy that handles routing, encryption and authentication. Enter Traefik.

[Unit]
Description=Traefik Proxy
[Service]
ExecStart=/opt/traefik -c /etc/traefik.toml
Restart=always
StandardOutput=syslog
SyslogIdentifier=traefik
User=root
Group=root
[Install]
WantedBy=default.target

A sample configuration file with Let's encrypt support:


################################################################
# Global configuration
################################################################

# Enable debug mode
#
# Optional
# Default: false
#
# debug = true

# Log level
#
# Optional
# Default: "ERROR"
#
# logLevel = "DEBUG"

# Entrypoints to be used by frontends that do not specify any entrypoint.
# Each frontend can specify its own entrypoints.
#
# Optional
# Default: ["http"]
#
defaultEntryPoints = ["http", "https"]

################################################################
# Entrypoints configuration
################################################################

# Entrypoints definition
#
# Optional
# Default:

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]
  [entryPoints.webadmin]
  address = ":8090"
  [entryPoints.traefik] # The entrypoint which fix the problem, but I don't know what is its purpose
  address = ":8100"

# Let's encrypt
[acme]
email = "info@ewus.de"
storage = "acme.json"
entryPoint = "https"
acmeLogging = true
OnHostRule = true
[[acme.domains]]
  main = "gitlab.ewus.de" 
[[acme.domains]]
  main = "app1.ewus.de"
[acme.httpChallenge]
entryPoint = "http"

[File]
  [frontends]
    [frontends.gitlab]
    backend = "gitlab"
      [frontends.gitlab.routes.test_1]
      rule = "Host: gitlab.ewus.de"
    [frontends.app1]
    backend = "app1"
      [frontends.app1.routes.test_1]
      rule = "Host: app1.ewus.de"
  [backends]
    [backends.gitlab]
      [backends.gitlab.servers.server1]
        url = "http://127.0.0.1:8086/"
        weight = 1
    [backends.app1]
      [backends.app1.servers.server1]
        url = "http://127.0.0.1:8089/"
        weight = 1