从我的Traefik Docker容器中获取HTTPS入口点时遇到一些实际问题。
我正在尝试遵循https://docs.traefik.io/user-guide/docker-and-lets-encrypt/
上的指南还尝试了https://docs.traefik.io/user-guide/examples/和https://ian-says.com/articles/traefik-proxy-docker-lets-encrypt/以及其他地方的各种位
在http中一切正常,但是https使我拒绝连接,并且在traefik Web门户中没有https入口点处于活动状态。
当我从外部检查端口443时,它说它已关闭,但是没有防火墙,并且它尚未使用(请参阅下面的docker ps
),所以我只能想到traefik容器本身不是为https正确设置?
我的问题:我如何在traefik上使用HTTPS?另外,我如何查看traefik日志以获取更多信息? docker-compose logs -f reverse-proxy
为空
traefik.toml
defaultEntryPoints = ["https","http"]
debug = true
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[acme]
email = "email@domain.com"
storage = "/home/project/acme.json"
caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
entryPoint = "https"
[acme.httpChallenge]
entryPoint = "http"
[[acme.domains]]
main = "domain.com"
sans = ["app.domain.com", "api.domain.com"]
docker-compose.yml
version: '3'
services:
reverse-proxy:
image: traefik
command: --api --docker
ports:
- "80:80"
- "443:443"
- "8080:8080" # The Web UI (enabled by --api)
networks:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /opt/traefik/traefik.toml:/home/project/traefik.toml
- /opt/traefik/acme.json:/home/project/acme.json
api:
build:
context: ./api/
dockerfile: Dockerfile
volumes:
- ~/api:/var/www/html
networks:
- web
restart: always
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:api.domain.com"
- "traefik.docker.network=web"
webapp:
build:
context: ./webapp/
dockerfile: DockerfileNode
volumes:
- ~/webapp:/app
networks:
- web
labels:
- "traefik.frontend.rule=Host:app.domain.com"
- "traefik.docker.network=web"
- "traefik.enable=true"
expose:
- 8188
networks:
web:
external: true
我的traefik门户的屏幕抓图 (注意:只有http入口点,没有https)
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d956a9d25ace webapp "/usr/bin/kafka-sock…" 18 minutes ago Up 16 minutes 8188/tcp webapp_1
e46693c8ca3e api "docker-php-entrypoi…" 21 minutes ago Up 16 minutes 80/tcp api_1
321c5efc720b traefik "/traefik --api --do…" 2 hours ago Up 16 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8080->8080/tcp reverse-proxy_1