If you've ever had to edit nginx.conf, run nginx -s reload, and manually set up certbot every time you add a new service to your VPS, Traefik will fundamentally change how you work. Traefik is a cloud-native reverse proxy that auto-configures itself from Docker labels, automatically obtains SSL certificates from Let's Encrypt, and routes traffic to containers without ever needing a restart.
This guide walks through setting up Traefik v3.8 on your VPS from scratch — covering installation, automatic SSL, real Docker Compose examples, middleware configuration, the dashboard, and troubleshooting common issues.
What Is Traefik?
Traefik (pronounced "Traffic") is an open-source reverse proxy and load balancer built specifically for cloud-native infrastructure. Unlike Nginx or HAProxy which require static configuration, Traefik automatically detects new services by reading Docker labels, Kubernetes annotations, Consul catalogs, or other provider metadata.
Traefik is running in production across billions of container instances worldwide. The latest stable release is v3.8.0 (November 2026), which added HTTP/3 support, per-router timeouts, and fixed several important CVEs.
- License: MIT (100% free, Community Edition)
- Written in: Go (fast, low resource usage)
- Integrations: Docker, Docker Swarm, Kubernetes, Consul, Nomad, AWS ECS
- ACME/SSL: Let's Encrypt, ZeroSSL, custom CA
- Protocols: HTTP/1.1, HTTP/2, HTTP/3, TCP, UDP, gRPC, WebSocket
- Source: github.com/traefik/traefik
Traefik vs Nginx Proxy Manager vs Nginx — Comparison
| Feature | Traefik v3 | Nginx Proxy Manager | Nginx (direct) |
|---|---|---|---|
| Auto-config from Docker | Yes (labels) | No (GUI) | No (config file) |
| SSL auto-renew | Yes (built-in ACME) | Yes (certbot) | Manual certbot |
| Restart to add service | Never | No (via GUI) | Reload needed |
| HTTP/3 support | Yes (v3+) | Extra setup | Extra setup |
| Middleware (rate limit, auth) | Full suite | Limited | Plugins required |
| Built-in dashboard | Yes | Yes (GUI) | No |
| Kubernetes support | Excellent (native) | No | Ingress nginx |
| Best for | Developers / DevOps | General users | Advanced users |
Data as of November 2026 — verify latest details at the provider's website.
Prerequisites
Before installing Traefik, make sure you have:
- A Linux VPS — Ubuntu 22.04 / 24.04 recommended. Minimum 1 GB RAM.
- Docker Engine + Docker Compose v2 installed
- A domain name with an A record pointing to your VPS IP address
- Ports 80 and 443 open in your firewall (
ufw allow 80/tcp && ufw allow 443/tcp) - Root or sudo access
Need a VPS? AsiaGB Cloud offers Linux VPS with full Docker support and Thai datacenter locations. DigitalOcean and Bangmod Cloud are also solid options.
Directory Structure
~/traefik/
├── docker-compose.yml # Traefik container definition
├── traefik.yml # static configuration
├── config/
│ └── dynamic.yml # dynamic config (optional)
└── letsencrypt/
└── acme.json # SSL certs store (chmod 600 required)
Static Configuration: traefik.yml
Create ~/traefik/traefik.yml:
api:
dashboard: true
insecure: false # never expose dashboard on port 8080
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
permanent: true
websecure:
address: ":443"
http3: {} # enable HTTP/3 (QUIC) — Traefik v3+ only
certificatesResolvers:
letsencrypt:
acme:
email: [email protected] # your real email
storage: /letsencrypt/acme.json
tlsChallenge: {}
providers:
docker:
exposedByDefault: false # explicit opt-in per service
file:
filename: /config/dynamic.yml
watch: true
log:
level: INFO # change to DEBUG for troubleshooting
docker-compose.yml for Traefik
version: '3.8'
services:
traefik:
image: traefik:v3.8
container_name: traefik
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yml:/traefik.yml:ro
- ./config:/config:ro
- ./letsencrypt:/letsencrypt
networks:
- traefik-public
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`traefik.yourdomain.com`)"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=admin:$$apr1$$YOURHASH"
networks:
traefik-public:
external: true
Step-by-Step Launch
# 1. Create the shared Docker network
docker network create traefik-public
# 2. Create acme.json with strict permissions (required)
mkdir -p ~/traefik/letsencrypt
touch ~/traefik/letsencrypt/acme.json
chmod 600 ~/traefik/letsencrypt/acme.json
# 3. Create config directory
mkdir -p ~/traefik/config
# 4. Generate a htpasswd hash for the dashboard
docker run --rm httpd:2.4-alpine htpasswd -nb admin YOUR_PASSWORD
# 5. Start Traefik
cd ~/traefik
docker compose up -d traefik
# 6. Watch logs
docker compose logs -f traefik
Adding Services with Docker Labels
Once Traefik is running, adding any web application is done entirely through Docker labels — no touching the Traefik config:
services:
myapp:
image: nginx:alpine
networks:
- traefik-public
labels:
- "traefik.enable=true"
- "traefik.http.routers.myapp.rule=Host(`myapp.yourdomain.com`)"
- "traefik.http.routers.myapp.entrypoints=websecure"
- "traefik.http.routers.myapp.tls.certresolver=letsencrypt"
- "traefik.http.services.myapp.loadbalancer.server.port=80"
networks:
traefik-public:
external: true
Run docker compose up -d myapp — Traefik detects the new service immediately, obtains an SSL certificate within 1–2 minutes, and starts routing HTTPS traffic. No Traefik restart needed.
Useful Middleware
Rate Limiting
labels:
- "traefik.http.middlewares.ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.ratelimit.ratelimit.burst=50"
- "traefik.http.middlewares.ratelimit.ratelimit.period=1m"
- "traefik.http.routers.myapp.middlewares=ratelimit"
Basic Authentication
# Generate hash (note: $ must be escaped as $$ in docker-compose)
docker run --rm httpd:2.4-alpine htpasswd -nb admin mypassword
labels:
- "traefik.http.middlewares.auth.basicauth.users=admin:$$apr1$$HASH"
- "traefik.http.routers.myapp.middlewares=auth"
IP Allowlist
labels:
- "traefik.http.middlewares.ipallow.ipallowlist.sourcerange=192.168.1.0/24,203.0.113.1/32"
- "traefik.http.routers.myapp.middlewares=ipallow"
Security Headers
labels:
- "traefik.http.middlewares.secure-headers.headers.stsSeconds=31536000"
- "traefik.http.middlewares.secure-headers.headers.stsIncludeSubdomains=true"
- "traefik.http.middlewares.secure-headers.headers.contentTypeNosniff=true"
- "traefik.http.middlewares.secure-headers.headers.browserXssFilter=true"
- "traefik.http.routers.myapp.middlewares=secure-headers"
Stacking Multiple Middlewares
labels:
- "traefik.http.routers.myapp.middlewares=auth,ratelimit,secure-headers"
Real-World Stack: WordPress + Ghost + Portainer
version: '3.8'
services:
wordpress:
image: wordpress:latest
networks: [traefik-public]
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wp
WORDPRESS_DB_USER: wpuser
WORDPRESS_DB_PASSWORD: secret
labels:
- "traefik.enable=true"
- "traefik.http.routers.wp.rule=Host(`blog.yourdomain.com`)"
- "traefik.http.routers.wp.entrypoints=websecure"
- "traefik.http.routers.wp.tls.certresolver=letsencrypt"
- "traefik.http.services.wp.loadbalancer.server.port=80"
ghost:
image: ghost:5-alpine
networks: [traefik-public]
environment:
url: https://news.yourdomain.com
labels:
- "traefik.enable=true"
- "traefik.http.routers.ghost.rule=Host(`news.yourdomain.com`)"
- "traefik.http.routers.ghost.entrypoints=websecure"
- "traefik.http.routers.ghost.tls.certresolver=letsencrypt"
- "traefik.http.services.ghost.loadbalancer.server.port=2368"
portainer:
image: portainer/portainer-ce:latest
networks: [traefik-public]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.portainer.rule=Host(`portainer.yourdomain.com`)"
- "traefik.http.routers.portainer.entrypoints=websecure"
- "traefik.http.routers.portainer.tls.certresolver=letsencrypt"
- "traefik.http.services.portainer.loadbalancer.server.port=9000"
networks:
traefik-public:
external: true
volumes:
portainer_data:
The Traefik Dashboard
Traefik includes a built-in web dashboard showing real-time data:
- All active routers with their rules and TLS status
- Services and load balancer health
- Active middlewares per router
- TLS certificate details and expiry dates
- Entrypoints and listening ports
- Backend container health checks
Access the dashboard at https://traefik.yourdomain.com/dashboard/ (the trailing slash is required). Log in with the credentials you configured in the Basic Auth middleware.
Production Tips
- Use Let's Encrypt staging first to avoid hitting the 5 certs/domain/week rate limit
- Back up acme.json weekly — it holds all your SSL certificates
- Monitor errors:
docker compose logs traefik | grep -E "error|warn" - Before major version upgrades, always read the official migration guide
- Enable HTTP/3 (
http3: {}in websecure) for performance gains - Set log rotation to prevent disk exhaustion from access logs
Troubleshooting
SSL Certificate Not Issuing
- Verify DNS:
dig +short yourdomain.comshould return your VPS IP - Check ports:
ufw status— ensure 80 and 443 are allowed - Check ACME logs:
docker compose logs traefik | grep -i acme - Rate limit hit? Switch to staging while testing
- Permissions:
ls -la letsencrypt/acme.json— must be 600
404 on All Routes
- Confirm the container is on the
traefik-publicnetwork - Verify
traefik.enable=truelabel is present - Check
exposedByDefault: falsein config — all services need an explicit label - Open the dashboard and confirm the router has been detected
Dashboard Won't Open
- DNS for dashboard subdomain must resolve to your VPS IP
- All
$in htpasswd hashes must be escaped as$$in docker-compose labels - URL must include trailing slash:
/dashboard/not/dashboard
Bottom Line: Who Should Use Traefik?
Traefik is the best choice for developers and DevOps engineers running multiple Docker containers on a single VPS. The auto-detection and auto-SSL workflow eliminates the manual overhead of Nginx + certbot. Version v3.8 is stable, ships with HTTP/3, and has had its critical CVEs patched. Recommended for anyone managing Docker workloads on a VPS.
Need a VPS to run Traefik? Start with a Linux VPS that supports full Docker deployment.
View AsiaGB Cloud VPSRelated Guides
Frequently Asked Questions
How is Traefik different from Nginx?
Traefik auto-configures itself through Docker labels — no need to reload or edit config files when adding new services. Nginx requires manual config edits and a reload for every new service or certificate change.
Does Traefik support automatic Let's Encrypt SSL?
Yes. Traefik has native ACME support. It automatically obtains and renews Let's Encrypt certificates before they expire, with no cron job or manual intervention required.
What is the latest version of Traefik?
The latest stable release is v3.8.0 (November 2026), which added HTTP/3 support, Kubernetes Gateway API ListenerSet, per-router timeouts, and fixed several CVEs.
Is Traefik free to use?
Yes. Traefik Community Edition is completely free and open source under the MIT license. Traefik Enterprise is a paid commercial product for large organizations needing enterprise support and additional features.
What VPS specs do I need?
Traefik is very lightweight (written in Go). A minimum of 1 vCPU + 512 MB RAM is enough for multiple services. For production workloads, 1 vCPU + 1 GB RAM is recommended.
Can Traefik be used with Kubernetes?
Yes. Traefik v3 natively supports Kubernetes Ingress Controller and the Kubernetes Gateway API — in fact, Kubernetes support is one of Traefik's headline features.