Good morning, everyone! I’m setting up Traefik as a reverse proxy for Mailcow, following the official Mailcow documentation: https://docs.mailcow.email/post_installation/reverse-proxy/r_p-traefik2/. However, I have a few questions.
Should I create a dedicated network for Traefik and add it to Mailcow’s override file, or use the same network as Mailcow and include it in Traefik’s compose file? For context, my VPS hosts only the Mailcow service, and I’m using a separate Traefik compose file, independent of Mailcow.
The local IP and port for Mailcow mentioned in the tutorial—do they refer to the IP of the Nginx container or to the address modified in mailcow.conf (HTTP_BIND) from the previous step?
HTTP_PORT=8080
HTTP_BIND=127.0.0.1
HTTPS_PORT=8444
HTTPS_BIND=127.0.0.1
Additionally, my Traefik docker-compose.yml is currently set up as follows:
services:
traefik:
image: traefik:v2.11
container_name: traefik
restart: always
ports:
- “80:80”
- “443:443”
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yml:/etc/traefik/traefik.yml:ro
- ./acme.json:/etc/traefik/acme.json
- ./dynamic_mail.yml:/etc/traefik/dynamic_mail.yml:ro
- ./usersfile:/etc/traefik/usersfile:ro
- ./logs:/var/log/traefik
labels:
- “traefik.enable=true”
dashboard
- “traefik.http.routers.dashboard.rule=Host(traefik.domain...
)”
- “traefik.http.routers.dashboard.entrypoints=websecure”
- “traefik.http.routers.dashboard.service=api@internal”
- “traefik.http.routers.dashboard.tls.certresolver=letsencrypt”
- “traefik.http.routers.dashboard.middlewares=auth”
Middleware auth
- “traefik.http.middlewares.auth.basicauth.usersfile=/etc/traefik/usersfile”
networks:
- traefik_web
networks:
traefik_web:
name: traefik_web
external: true
And my dynamic_mail.yml for Traefik is configured as follows:
… default configurations..
services:
mailcow-acme:
loadBalancer:
servers:
- url: “http://127.0.0.1:8080”
mailcow-frontend:
loadBalancer:
servers:
- url: “http://127.0.0.1:8080”
traefik.yml
entryPoints:
web:
address: “:80”
websecure:
address: “:443”
api:
dashboard: true
insecure: false
accessLog:
filePath: “/var/log/traefik/access.log”
bufferingSize: 100
filters:
statusCodes: [“400-499”, “500-599”]
certificatesResolvers:
letsencrypt:
acme:
email: example..@mail.com
storage: /etc/traefik/acme.json
httpChallenge:
entryPoint: web
providers:
docker:
endpoint: “unix:///var/run/docker.sock”
exposedByDefault: false
file:
filename: /etc/traefik/dynamic_mail.yml
watch: true
log:
level: INFO
When I try to access the service (e.g., mail.domain..), I get a 404 Page Not Found error. Could this be related to the network configuration, the IP/port settings, or something else in my Traefik setup?
Thank you in advance for your help and the amazing work everyone does!