我正在尝试使用 Traefik 作为 MariaDB 的反向代理,以便我可以从我的客户端进行连接。
目前,Traefik 在多个 WordPress 容器的 HTTP 和 HTTPS 上运行良好,但我无法为 MariaDB 配置它。
这是当前的配置:
Traefik 撰写文件:
version: '3.5'
networks:
traefik:
name: traefik
services:
traefik:
image: traefik:latest
restart: always
container_name: traefik
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.toml:/traefik.toml:ro
- ./acme.json:/acme.json
ports:
- 80:80
- 443:443
- 3306:3306
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.local`)"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users=username:$$apr1$$j994eiLb$$KmPfiii4e9VkZwTPW2/RF1"
networks:
- traefik
Run Code Online (Sandbox Code Playgroud)
Traefik 配置文件(traefik.toml):
# Network traffic will be entering our Docker network on the usual web ports …Run Code Online (Sandbox Code Playgroud)