我有一个由Tomcat和Traefik组成的docker-compose。当我要访问子域“ https://tomcat.bluehorse.duckdns.org/”时,它将返回“网关超时”以访问子域。
我可以访问“ https://traefik.bluehorse.duckdns.org/”(WEB ADMIN TRAEFIK) 并查看我的Traefik仪表板,其中所有后端和前端服务都在运行,但未运行“ https://tomcat.bluehorse.duckdns.org/”。
仪表板:
tomcat配置
<Connector port="80" protocol="AJP/1.3" redirectPort="8443" />
docker-compose.yml
version: '3'
services:
traefik:
image: traefik:latest
command: --docker --docker.domain=bluehorse.duckdns.org
ports:
- 80:80
- 443:443
networks:
- traefik
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik.toml:/traefik.toml
- ./acme.json:/acme.json
labels:
- "traefik.frontend.rule=Host:traefik.bluehorse.duckdns.org"
- "traefik.port=8080"
container_name: traefik
restart: always
webserver:
image: bitnami/tomcat:latest
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:tomcat.bluehorse.duckdns.org"
- "traefik.port=80"
volumes:
- /usr/tomcatfolder:/bitnami
networks:
traefik:
external: true
traefik.toml
#Traefik Global Configuration
debug = false
checkNewVersion = true
logLevel = "ERROR"
#Define the EntryPoint for HTTP and HTTPS
defaultEntryPoints = ["https","http"]
#Enable Traefik Dashboard on port 8080
#with basic authentication method
#user and password
[web]
address = ":8080"
[web.auth.basic]
users = ["xxxx:xxxx"] #password creado con htpaswd
#Define the HTTP port 80 and
#HTTPS port 443 EntryPoint
#Enable automatically redirect HTTP to HTTPS
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
#Enable retry sending a request if the network error
[retry]
#Define Docker Backend Configuration
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "bluehorse.duckdns.org"
watch = true
exposedbydefault = false
#Letsencrypt Registration
#Define the Letsencrypt ACME HTTP challenge
[acme]
email = "xxxxx@gmail.com"
storage = "acme.json"
entryPoint = "https"
acmeLoggin = true
onDemand = true
OnHostRule = true
[acme.httpChallenge]
entryPoint = "http"