Welcome to my very first Traefik configuration! I've got some things that you need to manage your web traffic, including routers, middlewares, and TLS.
To ensure a seamless user experience, I've set up the following routers:
- Dashboard: Manage your traffic like a pro with Traefik's user-friendly dashboard.
- Cat app: Let users access your cat app.
- Whoami: Check that your configurations are working smoothly with this useful tool.
- Prometheus: Monitor your traffic and gather key insights with this powerful tool.
- Grafana: Get a comprehensive overview of your web traffic metrics and stay ahead of the game.
- Custom error page: Keep your users engaged even when things go wrong with a custom error page.
My middlewares provide the following features to take your traffic management to the next level:
- Basic Auth (admin:admin): Keep your content secure with basic authentication.
- Rate limit: Prevent server overload by setting limits on the number of requests.
- Custom error page: Engage your users even when something goes wrong with a custom error page.
- Compress: Make your website load faster and reduce bandwidth usage.
I'm using Let's Encrypt with DNS challenge and Cloudflare API to ensure your traffic is always secure.
Ready to get started? Here's what you need to do:
Clone my repo with this command:
git clone https://github.com/behnambm/traefik.git
Create a file named .compose.env
and store your Cloudflare API key (Global API Key) with the following format:
CF_API_KEY=YOUR_KEY
CF_API_EMAIL=YOUR_EMAIL@MAIL.COM
Don't forget to set an A
record pointing to your domain in Cloudflare. Make sure it's a wildcard record, e.g., *.example.com
.
Some files, like docker-compose.yml
and dynamic.yml
, require you to change the host name to your own.
touch configs/letsencrypt/acme.json
chmod 600 configs/letsencrypt/acme.json
Start Traefik with the following command:
docker compose up -d
To check for any errors, run the following command:
docker compose logs traefik
And that's it! Your web traffic is now under your control with Traefik. Thanks for checking out my configuration!