For a while now I have just been using Nextcloud successfully with a Let's Encrypt certificate as well as a DuckDNS subdomain name, however now I want to use my own subdomain with Let's Encrypt. So the idea is that I have mydomain.duckdns.org, and a purchased domain name of mydomain.com, with a cname of cloud.mydomain.com pointing to mydomain.duckdns.org.
Oddly, I have this working with another Wordpress web server I have, but it's using nginx. I tried to expand my current certificate using this command:
certbot certonly --webroot -w /var/www/html -d mydomain.duckdns.org -d cloud.mydomain.com
When I run that command certbot asks if I want to expand my certificate to include my new domain name with my current certificate and everything works without error, here's the output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/mydomain.duckdns.org.conf)
It contains these names: mydomain.duckdns.org
You requested these names for the new certificate: mydomain.duckdns.org,
cloud.mydomain.com.
Do you want to expand and replace this existing certificate with the new
certificate?(E)xpand/(C)ancel: E
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for mydomain.duckdns.org
http-01 challenge for cloud.mydomain.com
Using the webroot path /var/www/html for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/mydomain.duckdns.org-0001/fullchain.pem.
Your cert will expire on 2017-08-08. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew all of your certificates, run
"certbot renew"- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: Donate - Let's Encrypt
Donating to EFF: Support EFF's Work on Let's Encrypt | Electronic Frontier Foundation
Additionally, I did a restart of Apache and also tried just restarting the server afterwards. When I visit cloud.mydomain.com I get the error:
cloud.mydomain.com uses an invalid security certificate. The certificate is only valid for mydomain.duckdns.org Error code: SSL_ERROR_BAD_CERT_DOMAIN
I am using the PPA provided on certbot.eff.org on an Ubuntu 16.04 server. I have also cleared all the caches on my web browsers. Strangely, Safari on my iPhone doesn't complain, but Brave on my iPhone does. My goal is to just be able to access cloud.mydomain.com and not see mydomain.duckdns.org when using the server. Is this a certificate error? I have 2 ServerName lines in my apache configs