[英]Traefik entrypoints and default certificate
問題1
https://docs.traefik.io/configuration/entrypoints/#default-certificate似乎表明,如果我未指定任何certFile
或keyFile
,則keyFile
將生成自簽名證書,並將其使用。
每個入口點只能設置一個defaultCertificate。 使用一組方括號[],而不是普通證書所需的兩個。 如果未提供默認證書,則Traefik將生成自簽名證書,並將其使用。
但是,當我嘗試此操作並輸入https:// localhost / whoami時 ,Chrome發出SSL錯誤(ERR_SSL_PROTOCOL_ERROR)。 日志還顯示level=error msg="failed to load X509 key pair: tls: failed to find any PEM data in certificate input"
。 我是否誤解了該文檔中的配置?
這是我必須測試的代碼。
測試文件
version: '3.6'
services:
traefik:
image: traefik
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik/traefik.toml:/etc/traefik/traefik.toml
deploy:
placement:
constraints:
- node.role == manager
labels:
- "traefik.port=8080"
- "traefik.frontend.rule=PathPrefixStrip:/traefik"
networks:
- traefiknet
whoami:
image: emilevauge/whoami
deploy:
labels:
- "traefik.port=80"
- "traefik.frontend.rule=PathPrefixStrip:/whoami"
networks:
- traefiknet
networks:
traefiknet:
traefik.toml
logLevel = "DEBUG"
defaultEntryPoints = ["http", "https"]
[api]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[entryPoints.https.tls.defaultCertificate]
[docker]
endpoint = "unix:///var/run/docker.sock"
watch = true
swarmMode = true
network = "test_traefiknet"
從...開始:
docker stack deploy -c test.yml test
問題2
請注意,我還測試了它是否喜歡此頁面上的內容: https : //docs.traefik.io/configuration/entrypoints/#static-certificates
如果提供了空的TLS配置,則會生成默認的自簽名證書。
但是,這也不起作用。 但是我的問題是,此配置與toml文件中問題1中所示的配置有什么區別?
我找到了答案。 我需要刪除[entryPoints.https.tls.defaultCertificate]
。 不幸的是,我在這方面的文檔並不十分清楚。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.