2.3 KiB
2.3 KiB
Traefik Reverse Proxy Setup
A simple Docker Compose setup for Traefik reverse proxy with automatic HTTPS certificates.
Quick Start
-
Clone and configure
git clone https://github.com/yblis/netbird-traefik cd netbird-traefil/traefik-setup -
Edit configuration files
- In
docker-compose.yml: Replacetraefik.domain.comwith your domain - In
data/traefik.toml: Replaceadmin@domain.comwith your email - In
docker-compose.yml: ReplaceYOURHASHBASICPASSWORDwith your hashed password
- In
-
Set up DNS
- Create an A record pointing your domain to your server IP
- Example:
traefik.yourdomain.com→your.server.ip
-
Create required files
mkdir -p data touch data/acme.json chmod 600 data/acme.json -
Start Traefik
docker-compose up -d
Configuration Details
Domain Setup
Replace these values in the configuration files:
traefik.domain.com→ Your actual domainadmin@domain.com→ Your email for Let's EncryptYOURHASHBASICPASSWORD→ Your hashed password (see below)
Generate Password Hash
echo $(htpasswd -nb admin yourpassword) | sed -e s/\\$/\\$\\$/g
Access Points
- Traefik Dashboard:
https://traefik.yourdomain.com - HTTP: Port 80 (redirects to HTTPS)
- HTTPS: Port 443
- Dashboard Direct: Port 8001 (HTTP only)
Features
- ✅ Automatic HTTPS with Let's Encrypt
- ✅ HTTP to HTTPS redirection
- ✅ Basic authentication for dashboard
- ✅ Docker integration
- ✅ File-based service configuration
File Structure
.
├── docker-compose.yml
└── data/
├── traefik.toml
├── services.toml
└── acme.json
Adding Services
To add a new service behind Traefik, add these labels to your service in docker-compose:
labels:
- "traefik.http.routers.myapp.rule=Host(`myapp.yourdomain.com`)"
- "traefik.http.routers.myapp.entrypoints=https"
- "traefik.http.routers.myapp.tls.certresolver=webssl"
- "traefik.http.services.myapp.loadbalancer.server.port=80"
Troubleshooting
- Check logs:
docker-compose logs traefik - Verify DNS resolution:
nslookup traefik.yourdomain.com - Ensure ports 80 and 443 are open
- Check acme.json permissions:
ls -la data/acme.json(should be 600)