← Start of tutorial

WIUNIX ACADEMY

Set up Traefik with Let’s Encrypt and HTTP/3 on Linux

Page 3 of 7. Review the earlier steps and prerequisites before continuing.

YOUR SYSTEM. YOUR STEPS.

Where are you working?

Choose your OS and version. The prerequisites, commands and troubleshooting follow your environment.

RHEL 9.8Reviewed against official documentation ·

USE YOUR OWN VALUES

Configure this tutorial

Set the example values for your environment; related explanations and copy panels update together. Never enter passwords, private keys or tokens. Values stay in this tab and are not sent to the server or share links. Check actual DNS, certificates and network policy before running commands.

Different IP addresses, domains or ports? Open the settings below, change the values and select “Apply to tutorial”, then copy the updated commands.

Set values for my environment11 editable values
09

LET’S BUILD

Open the staging configuration

Start against Let’s Encrypt staging with its separate account/state. api.insecure remains false. No public dashboard router exists. The default HTTP redirect is temporary to avoid sticky browser redirects during setup; HTTP-01 is compatible with the entrypoint redirect. No certificate, password or private key is pasted into the public settings.

Bash

Dedicated Linux host

sudoedit '/etc/traefik-academy/traefik.yml'
How do I know it worked?

Editor ready for the complete static YAML below.

Static Traefik YAML: staging first

FILE CONTENT: HTTP/3 is enabled on the TLS TCP entrypoint and also opens UDP/443; it is not an experimental flag in this release. Only TLS routers use it. The ACME contact email is optional in this example; if your account policy requires one, add email under acme in this root-controlled editor, not in a browser field. No DNS API credential is needed for HTTP-01. Access logs are not enabled; operational logs can still contain domain/error data and need protected retention.

yaml · /etc/traefik-academy/traefik.yml
global:
  checkNewVersion: false
  sendAnonymousUsage: false
entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
          permanent: false
  websecure:
    address: ":443"
    http3: {}
  admin:
    address: "127.0.0.1:8080"
api:
  dashboard: true
  insecure: false
  debug: false
providers:
  file:
    directory: "/etc/traefik-academy/dynamic"
    watch: true
certificatesResolvers:
  le:
    acme:
      caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
      storage: "/var/lib/traefik-academy/acme-staging.json"
      httpChallenge:
        entryPoint: web
log:
  level: INFO
10

LET’S BUILD

Open the dynamic routing file

Use a watched directory rather than replacing a lone bind-mounted file. This host-service design has no container bind mount. File-provider changes normally reload automatically; static entrypoints and ACME changes need a controlled service restart. Never edit generated ACME JSON manually.

Bash

Dedicated Linux host

sudoedit '/etc/traefik-academy/dynamic/routes.yml'
How do I know it worked?

Editor open for the dynamic file below.

Dynamic routes: app and private admin

FILE CONTENT: only the exact application Host reaches the marker over TLS. The API/dashboard rule is limited to the loopback admin entrypoint. Untrusted clients cannot choose a backend through a supplied URL. Forwarded headers are not blindly trusted. If replacing the marker with a remote origin, use authenticated verified HTTPS and a separately reviewed route; do not set insecureSkipVerify.

yaml · /etc/traefik-academy/dynamic/routes.yml
http:
  routers:
    app:
      rule: "Host(`app.example.com`)"
      entryPoints: [websecure]
      service: marker
      tls:
        certResolver: le
        options: modern
    admin:
      rule: "PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      entryPoints: [admin]
      service: api@internal
  services:
    marker:
      loadBalancer:
        servers:
          - url: "http://127.0.0.1:8081"
tls:
  options:
    modern:
      minVersion: VersionTLS12
11

LET’S BUILD

Open the restricted proxy service

Grant only the capability needed for ports below 1024. The process runs as the dedicated non-login user, reads root-controlled configuration, and can write only its ACME directory. Do not give it a Docker socket, root account or membership in privileged groups.

Bash

Dedicated Linux host

test ! -e /etc/systemd/system/traefik-academy.service &&
sudoedit /etc/systemd/system/traefik-academy.service
How do I know it worked?

Editor open for the new proxy unit.

Proxy service file

FILE CONTENT: systemd protects the filesystem and retains only CAP_NET_BIND_SERVICE. ReadWritePaths does not bypass ordinary ownership; the state directory must still belong to the service user. Network isolation is intentionally not enabled because DNS, ACME, public listeners and the same-host origin are needed.

ini · /etc/systemd/system/traefik-academy.service
[Unit]
Description=Academy Traefik HTTPS and HTTP3 edge
Wants=network-online.target
After=network-online.target academy-traefik-origin.service

[Service]
Type=simple
User=traefik-academy
Group=traefik-academy
ExecStart=/usr/local/bin/traefik --configFile=/etc/traefik-academy/traefik.yml
Restart=on-failure
RestartSec=5s
UMask=0077
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/traefik-academy

[Install]
WantedBy=multi-user.target
Explore all tutorials ↗