traefik:v3.7 image on ports 80 and 443 with the Docker provider, a websecure entry point and an ACME certificate resolver that stores certificates in acme.json. Then add labels such as traefik.http.routers.app.rule=Host(`app.example.com`) and tls.certresolver=le to each container. Traefik requests and renews the certificates by itself.
Before you start
- Traefik is a reverse proxy that watches Docker. When a container with Traefik labels starts, Traefik creates the route and the HTTPS certificate for it. You never edit a proxy config file.
- Ports 80 and 443 must be free. Stop any Nginx, Apache, Caddy or Nginx Proxy Manager on the server first.
- Create
A(andAAAA) records for every domain, pointing at your server, before you start Traefik. See point a domain to your server. - Run the commands as a user in the
dockergroup, or putsudoin front.
How to install Traefik with Let’s Encrypt
1
Create a project folder
letsencrypt will hold acme.json, the file with your certificates and private keys.2
Create a login for the dashboard
Install Type a password twice. The file stores a bcrypt hash, not the password.
htpasswd (sudo apt install apache2-utils on Ubuntu/Debian, sudo dnf install httpd-tools on AlmaLinux/Rocky), then create a user called admin:3
Create compose.yaml
Replace
you@example.com and the domains with your own.4
Start Traefik
Ctrl+C to stop following the log. Errors about the certificate show up here.What do the settings mean?
The
whoami container is a small test app. Remove it from compose.yaml once your own app works.
How to put another app behind Traefik
Add theproxy network and labels to the app’s own compose.yaml. This example serves Uptime Kuma on status.example.com:
ports: section, so it is reachable only through Traefik. The loadbalancer.server.port label tells Traefik which port inside the container to use. Each router name (kuma, whoami) must be unique on the server.
How to check it worked
Location: https://whoami.example.com/. The second prints the whoami output, starting with Hostname:. Open https://traefik.example.com and log in to see your routers on the dashboard.
Frequently asked questions
Why does my site show “TRAEFIK DEFAULT CERT”?
Traefik couldn’t get a Let’s Encrypt certificate yet. Checkdocker compose logs traefik for ACME errors. The usual causes are a DNS record that doesn’t point at this server, port 80 being blocked, or a missing tls.certresolver=le label. While testing, add --certificatesresolvers.le.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory so you don’t hit Let’s Encrypt’s rate limits, then remove it and delete acme.json.
Why do I get “404 page not found”?
No router matches the domain. Check that the container hastraefik.enable=true, that its Host() rule matches the domain exactly, and that it is on the proxy network.
Do I need to publish the dashboard on port 8080?
No. Traefik’s examples use--api.insecure=true on port 8080 for local testing. On a public server, keep the dashboard on a domain behind authentication as shown above, or leave out --api.dashboard=true.
Where are the certificates stored?
In~/traefik/letsencrypt/acme.json. Back up that folder with the rest of the project and keep it private, because it contains the private keys.
Related guides
VPS and dedicated server guides
Every guide in this section.
Nginx Proxy Manager
A reverse proxy you manage in a web interface.
Docker Compose tutorial
The compose.yaml format.
Secure Docker on a VPS
Firewalls, the docker group and the socket.
Install Dokploy
A deploy platform built on Traefik.
Checked against the official Traefik documentation (Docker setup, Let’s Encrypt and middlewares and BasicAuth) on 4 November 2026;
compose.yaml files validated with Docker Compose v5.6.1 and htpasswd tested on Ubuntu 24.04 LTS. Traefik itself was not run, because image downloads were not available in our test environment.Need Extra Help?
If you encounter any issues, our support team is ready to assist:- Live Chat: Quick assistance via our website.
- Support Ticket: Open a Ticket
- Discord: Join our Community
- Email: support@freakhosting.com
Last Updated: November 2026