PavshinSergei Because if the keys were not generated and placed in the ./data/assets/ssl/ folder,
That’s what the ACME container is for :/ you don’t need to put your own certificate in there
So let’s assume you have two domains whcih you already added to the domain tab in your mailcow UI:
domain1.tld
domain2.tld
Your primary mailcow hostname is mail.domain1.tld, and you added a CNAME (or an A record if you want to) for mail.domain2.tld, webmail.domain1.tld and webmail.domain2.tld which point to your primary hostname
Step 1: add webmail.* to ADDITIONAL_SAN in mailcow.conf
ADDITIONAL_SAN=mail.*,webmail.*
Step 2: add the Nginx config to redirect your webmail URLs:
data/conf/nginx/webmail.conf
server {
ssl_certificate /etc/ssl/mail/cert.pem;
ssl_certificate_key /etc/ssl/mail/key.pem;
index index.php index.html;
client_max_body_size 0;
root /web;
include /etc/nginx/conf.d/listen_plain.active;
include /etc/nginx/conf.d/listen_ssl.active;
server_name webmail.domain1.tld;
server_tokens off;
location ^~ /.well-known/acme-challenge/ {
allow all;
default_type "text/plain";
}
location / {
return 301 https://webmail.domain1.tld/SOGo;
}
}
server {
ssl_certificate /etc/ssl/mail/cert.pem;
ssl_certificate_key /etc/ssl/mail/key.pem;
index index.php index.html;
client_max_body_size 0;
root /web;
include /etc/nginx/conf.d/listen_plain.active;
include /etc/nginx/conf.d/listen_ssl.active;
server_name webmail.domain2.tld;
server_tokens off;
location ^~ /.well-known/acme-challenge/ {
allow all;
default_type "text/plain";
}
location / {
return 301 https://webmail.domain2.tld/SOGo;
}
}
Restart the Nginx container:
docker compose restart nginx-mailcow
Then apply the changes to your stack:
docker compose up -d
The ACME container will fetch a new certificate for mail.domain2.tld, webmail.domain1.tld and webmail.domain2.tld automatically! No need for you to run certbot manually and copy stuff
That should be it