October 25, 2026 · by Alex M.
Running multiple web applications on a single NVMe VPS and tired of manually managing Nginx configs, SSL certificates, and port forwarding? Traefik is the modern, cloud-native solution that automates all of that.
Traefik is an open-source reverse proxy and load balancer designed for microservices and containerised environments. It integrates natively with Docker and Kubernetes, automatically discovers new services, issues Let's Encrypt certificates on the fly, and never requires a restart to update routing rules. This guide walks you through a complete Traefik setup on Ubuntu 22.04.
Traefik stands out from traditional reverse proxies for several reasons:
If you have an SSD VPS running multiple Docker containers — WordPress, Nextcloud, custom apps — Traefik becomes an incredibly efficient traffic orchestrator.
Before starting, make sure you have:
apt update && apt upgrade -y
apt install -y ca-certificates curl gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
> /etc/apt/sources.list.d/docker.list
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
Verify the installation:
docker --version
docker compose version
Create a dedicated directory for Traefik:
mkdir -p /opt/traefik/data
cd /opt/traefik
Create the SSL certificate storage file:
touch /opt/traefik/data/acme.json
chmod 600 /opt/traefik/data/acme.json
Important: The
600permission onacme.jsonis mandatory. Traefik will refuse to start if this file is accessible to other users.
nano /opt/traefik/data/traefik.yml
api:
dashboard: true
insecure: false
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
certificatesResolvers:
letsencrypt:
acme:
email: [email protected]
storage: /data/acme.json
httpChallenge:
entryPoint: web
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
network: traefik-net
log:
level: INFO
accessLog: {}
Key settings explained:
redirections: automatically redirects all HTTP traffic to HTTPSexposedByDefault: false: containers are only exposed when explicitly labellednetwork: traefik-net: dedicated Docker network for TraefikCreate the external Docker network:
docker network create traefik-net
Create docker-compose.yml:
nano /opt/traefik/docker-compose.yml
version: '3.8'
services:
traefik:
image: traefik:v3.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /opt/traefik/data/traefik.yml:/traefik.yml:ro
- /opt/traefik/data/acme.json:/data/acme.json
networks:
- traefik-net
labels:
- "traefik.enable=true"
- "traefik.http.routers.dashboard.rule=Host(`traefik.yourdomain.com`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls.certresolver=letsencrypt"
- "traefik.http.routers.dashboard.service=api@internal"
- "traefik.http.routers.dashboard.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=admin:$$apr1$$xyz..."
networks:
traefik-net:
external: true
apt install -y apache2-utils
htpasswd -nb admin YourSecurePassword123
# Example output: admin:$apr1$8Kv...Hash
In docker-compose.yml, replace every $ in the hash with $$ (Docker Compose escaping).
cd /opt/traefik
docker compose up -d
Verify it's running:
docker ps
docker logs traefik --tail=50
The dashboard will be available at https://traefik.yourdomain.com within seconds after the SSL certificate is issued.
Let's add a simple Nginx container to demonstrate dynamic routing:
mkdir -p /opt/apps/mysite
nano /opt/apps/mysite/docker-compose.yml
version: '3.8'
services:
mysite:
image: nginx:alpine
container_name: mysite
restart: unless-stopped
networks:
- traefik-net
labels:
- "traefik.enable=true"
- "traefik.http.routers.mysite.rule=Host(`site.yourdomain.com`)"
- "traefik.http.routers.mysite.entrypoints=websecure"
- "traefik.http.routers.mysite.tls.certresolver=letsencrypt"
networks:
traefik-net:
external: true
cd /opt/apps/mysite
docker compose up -d
Traefik automatically detects the new container, issues an SSL certificate for site.yourdomain.com, and routes traffic — with no Traefik restart and no config file changes.
Middleware lets you enhance routes with additional functionality:
labels:
- "traefik.http.middlewares.ratelimit.ratelimit.average=100"
- "traefik.http.middlewares.ratelimit.ratelimit.burst=50"
- "traefik.http.routers.mysite.middlewares=ratelimit"
labels:
- "traefik.http.middlewares.secheaders.headers.stsSeconds=31536000"
- "traefik.http.middlewares.secheaders.headers.stsIncludeSubdomains=true"
- "traefik.http.middlewares.secheaders.headers.contentTypeNosniff=true"
- "traefik.http.middlewares.secheaders.headers.browserXssFilter=true"
- "traefik.http.routers.mysite.middlewares=secheaders"
labels:
- "traefik.http.middlewares.compress.compress=true"
- "traefik.http.routers.mysite.middlewares=compress"
Chain multiple middleware with a comma:
- "traefik.http.routers.mysite.middlewares=ratelimit,secheaders,compress"
View live logs:
docker logs traefik -f
To persist logs to files, add to traefik.yml:
log:
level: WARNING
filePath: /data/traefik.log
accessLog:
filePath: /data/access.log
bufferingSize: 100
Traefik natively exposes Prometheus metrics, making it easy to integrate with a Prometheus and Grafana monitoring stack:
metrics:
prometheus:
entryPoint: metrics
entryPoints:
metrics:
address: ":8082"
Updating to a new version:
cd /opt/traefik
docker compose pull
docker compose up -d
Check the current version:
docker exec traefik traefik version
Always back up your certificates before major updates:
cp /opt/traefik/data/acme.json /opt/traefik/data/acme.json.bak
| Feature | Traefik | Nginx Proxy Manager |
|---|---|---|
| Docker auto-discovery | ✅ Native | ❌ Manual |
| Automatic SSL | ✅ | ✅ |
| Dashboard | ✅ Built-in | ✅ Web UI |
| Configuration method | Docker Labels | Web interface |
| Advanced middleware | ✅ | Limited |
| Best suited for | DevOps, containers | Non-technical users |
curl http://yourdomain.comacme.json permissions: chmod 600docker logs traefik 2>&1 | grep -i acmetraefik.enable=true label is settraefik-net network$$ instead of $Traefik dramatically simplifies traffic management for multi-application Docker environments. With automatic SSL, live dynamic routing, and a rich middleware ecosystem, it is a cornerstone tool in any modern DevOps stack.
To get the most out of Traefik, you need a reliable, high-performance server. CLIQHOST NVMe VPS plans offer fast NVMe storage, solid connectivity, and the resources needed to run complex containerised workloads without compromise.
For production-grade infrastructure with maximum performance, explore CLIQHOST managed dedicated servers — fully administered, enterprise-ready solutions.
Need expert help setting up or managing your server? The CLIQHOST server management service handles all the technical heavy lifting for you. Get in touch — we respond quickly.
Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.
"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."
"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."
"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."