Hi everyone.
I'm using docker with traefik 2.10 and dynamics files (yaml).
I'm facing a problem with container's domain certificate. I cannot use lets encrypt or other provider.
when I use my certificate which is configured with 2 files a .cert and a .key the web doesn´t work showing the error "404 page not found" in the web browser and in the traefik log I always get this errors:
level=error msg="accept tcp [::]:80: use of closed network connection" entryPointName=web
level=error msg="close tcp [::]:443: use of closed network connection" entryPointName=websecure
But If I use lets encrypt the problem is solved and I can surf the website without problems.
This is my traefik.yml configuration:
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
# http:
# tls:
# certResolver: lets-encrypt
providers:
docker:
endpoint: unix:///var/run/docker.sock
exposedByDefault: false
watch: true
swarmMode: false
file:
directory: /etc/traefik/configuration
watch: true
This is a fragment of my docker-compose file with the traefik config:
traefik:
image: traefik:latest
container_name: traefik
restart: always
networks:
redesproxy:
ipv4_address: 172.20.1.3
ports:
- "80:80"
- "443:443"
security_opt:
- no-new-privileges:true
volumes:
- traefik_data:/etc/traefik
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./data/traefik.yml:/etc/traefik/traefik.yml
- ./data/configuration:/etc/traefik/configuration **# Folder with dynamic configuration yml including certs files**
My web.yml dynamic file:
http:
routers:
www-web-develop:
service: www-develop-service
entryPoints:
- websecure
rule: "Host(`www.mydomain.com`)"
middlewares:
- gzip
services:
www-develop-service:
loadBalancer:
servers:
- url: "http://172.20.1.4:9007"
And finally in other yml file I have the certs config: (tls.yml)
tls:
certificates:
- certFile: /etc/traefik/configuration/certs/www.mydomain.com.crt
keyFile: /etc/traefik/configuration/certs/www.mydomain.com.key
I check both files with OpenSSL and they have the same output.
What I missing in the certificates configuration? Or maybe I'm doing something wrong.
So... what do I need to do to get this domain with https work?