docker - Traefik HTTPS 入口点配置无法通过让加密工作
问题描述
在我的 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 门户网站中没有 https 入口点处于活动状态。
当我从外部检查端口 443 时,它说它已关闭,但是没有防火墙,并且它还没有被使用(见docker ps
下文),所以我只能认为 traefik 容器本身没有为 https 正确设置?
我的问题:如何让 HTTPS 在 traefik 上运行?另外,我如何查看 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"]
码头工人-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)
码头工人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
解决方案
推荐阅读
- php - htaccess 无法将文章 ID 重定向到使用 php slug 函数生成的文章 slug
- firebase - Firebase Stream 功能无法正常工作
- php - 具有多个条件的 laravel 查询更新
- powerbi - Microsoft Power BI:折线图过去 13 周的数据 3 年
- vba - 在列中查找第 n 次出现 - Excel VBA
- c++ - Windows Sockets 理解接收和发送
- r - Convert latitude and longitude to Spatial Points and project them over another map in R
- python - 有没有办法在没有任何导入包的情况下在 python 中显示简单的图形可视化
- python - 映射器代码使用 unix 管道运行,但不使用 hadoop 流。错误不适用。流式传输命令失败
- r - max.col(R语言)的反函数是什么