Hey guys,
i have some Problems with Traefik, which is run in docker:
- I want to secure the traefik dashboard, doesn't work. When i call traefik, i'm allways directly on the dashboard
- I want do redirect from http to https automaticly, doesn't work. I can call the URL with https://pma.localhost but with http:// i got an 404
- I want that traefik automaticly install TLS Certs, doesn't work. https://pma.localhost allways brings an certification error. No acme.json is created.
I despair
So, here is my toml file:
[global]
sendAnonymousUsage = false
[api]
dashboard = true
debug = true
insecure = true
[log]
level = "DEBUG"
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[http.routers]
[http.routers.redirecttohttps]
entryPoints = ["http"]
middlewares = ["httpsredirect"]
rule = "HostRegexp(`{host:.+}`)"
service = "noop"
[http.middlewares]
[http.middlewares.httpsredirect.redirectScheme]
permanent = true
scheme = "https"
port = 443
[certificatesresolvers]
[certificatesresolvers.mytlschallenge.acme]
email = "mymail adress"
storage = "/certs/acme.json"
[certificatesResolvers.mytlschallenge.acme.httpChallenge]
entryPoint = "http"
[certificatesResolvers.mytlschallenge.acme.tlsChallenge]
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
network = "mynetwork"
And this is docker compose, traefik and one container with phpMyAdmin:
version: "3.7"
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
depends_on:
- ${PMA}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
- ./traefik/traefik.toml:/etc/traefik/traefik.toml:ro
- ./traefik/certs:/certs:rw
ports:
- 80:80
- 8080:8080
- 443:443
labels:
- traefik.http.middlewares.auth.basicauth.users=admin:$$2y$$05$$O/F51ypL6pGkFyk65MGhx.htOTpQ4iYj1t/3j2OCDvyuLUnwaQ9QK
networks:
mynetwork:
ipv4_address: ${TRAEFIK_IP}
pma:
image: phpmyadmin/phpmyadmin:5
container_name: ${PMA}
restart: unless-stopped
volumes:
- /sessions
environment:
- PMA_HOSTS=${DATABASE},${DATABASE_SERVICES}
links:
- ${DATABASE}
- ${DATABASE_SERVICES}
volumes:
- /sessions
- ./pma/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php
- ./pma/php.ini:/usr/local/etc/php/php.ini
networks:
mynetwork:
ipv4_address: ${PMA_IP}
labels:
- traefik.enable=true
- traefik.http.routers.pma.tls.certresolver=mytlschallenge
- traefik.http.routers.pma.entrypoints=https
- traefik.http.routers.pma.rule=Host(`pma.localhost`)
Thx for help
Cheers
Ralf