我有一个生成ACME证书的Traefik反向代理,我想在我的docker容器上启用SSL。
在我的容器中,我有一张自签名证书,但Traefik拒绝连接它。
我的 docker-compose.yml :
version: "2"
services:
magento:
image: lavoweb/php-5.6
expose:
- 80
- 443
volumes:
- ./data/src/:/var/www/html
labels:
- "traefik.port=80"
- "traefik.backend=swarm"
- "traefik.protocol=https"
- "traefik.frontend.rule=Host:1.swarm.lavoweb.net"
- "traefik.docker.network=web"
networks:
- web
- internal
networks:
web:
external:
name: web
internal:
driver: bridge
我收到了这个错误:
内部服务器错误
答案 0 :(得分:4)
这就是我使用Docker Swarm和Docker Compose V3实现LetsEncrypt自动续订的方法:
version: '3'
services:
traefik:
image: traefik
command: --web --docker --docker.domain=docker.localhost --docker.watch \
--logLevel=DEBUG \
--defaultEntryPoints='http,https' \
--entryPoints='Name:http Address::80' \
--entryPoints='Name:https Address::443 TLS' \
--docker.swarmmode=true \
--docker.exposedbydefault=false \
--acme \
--acme.entryPoint='https' \
--acme.email='marciopuga@gmail.com' \
--acme.ondemand=false \
--acme.acmelogging=true \
--acme.onhostrule=true \
--acme.storage='/etc/traefik/acme/acme.json'
networks:
- default
- traefik-net
ports:
- "80:80"
- "8080:8080"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- traefikdata:/etc/traefik/acme
mytestservice:
image: blah/mytestservice
networks:
- default
- traefik-net
ports:
- "8001:80"
deploy:
labels:
- "traefik.port=80"
- "traefik.enable=true"
- "traefik.backend=machine-mytestservice"
- "traefik.docker.network=traefik-net"
- "traefik.frontend.rule=Host:mydomain.com,www.mydomain.com"
networks:
traefik-net:
volumes:
traefikdata: