https://github.com/gh640/traefik-examples
Examples to use Traefik reverse proxy v2 with `docker-compose`.
https://github.com/gh640/traefik-examples
traefik traefik-v2
Last synced: 7 months ago
JSON representation
Examples to use Traefik reverse proxy v2 with `docker-compose`.
- Host: GitHub
- URL: https://github.com/gh640/traefik-examples
- Owner: gh640
- License: mit
- Created: 2020-11-05T04:17:11.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-27T12:16:01.000Z (over 4 years ago)
- Last Synced: 2025-01-14T14:17:13.792Z (9 months ago)
- Topics: traefik, traefik-v2
- Language: Shell
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Traefik examples
Examples to use [Traefik reverse proxy](https://traefik.io/) v2 with `docker-compose`.
## Examples
1. `whoami`: Single service with `traefik/whoami`
1. `nginx`: Multiple services with `nginx`
1. `https-with-traefik-default-cert`: https (TLS) using Traefik default self-signed certificate
1. `https-with-self-signed-cert`: https (TLS) using self-signed certificate
1. `https-with-letsencrypt`: https (TLS) using Let's Encrypt## Usage
### `whoami`
```bash
cd repo-root/whoami/
docker-compose up -d
``````bash
http 127.0.0.1 Host:whoami.docker.localhost
```### `nginx`
```bash
cd repo-root/nginx/
docker-compose up -d
``````bash
http 127.0.0.1 Host:tako.example.com
http 127.0.0.1 Host:ika.example.com
```### `https-with-traefik-default-cert`
```bash
cd repo-root/https-with-traefik-default-cert/
echo 'DOMAIN=localhost' > .env
docker-compose up -d
``````bash
http --verify=no --default-scheme=https localhost
```### `https-with-self-signed-cert`
```bash
cd repo-root/https-with-self-signed-cert/
echo 'DOMAIN=localhost' > .env
docker-compose up -d
``````bash
http --verify=no --default-scheme=https localhost
```The certificate is stored in a Docker volume named `certs`. Please clear the volume once you've finished.
```bash
docker volume rm https-with-self-signed-cert_certs
```### `https-with-letsencrypt`
You need to make the server public first so that the Let's Encrypt server can access your server.
```bash
cd repo-root/https-with-letsencrypt/
echo 'DOMAIN=mydomain.com' > .env
docker-compose up -d
``````bash
http --verify=no --default-scheme=https [IP] Host:mydomain.com
```If you want to get a valid certificate, comment out the line for `caServer`:
`traefik.yml`:
```yaml
# caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
```The certificate is stored in a Docker volume named `letsencrypt`. Please clear the volume once you've finished.
```bash
docker volume rm https-with-letsencrypt_letsencrypt
```## Links
- [GitHub - traefik/traefik: The Cloud Native Application Proxy](https://github.com/traefik/traefik)
- [Traefik](https://doc.traefik.io/traefik/)