You need to specify both www and non-www and every subdomain you want it installed on. Make sure you specify which version of the www or no www you want first, as I tried to renew one and mistakenly i used -d domain.com twice, instead of one www and one non-www and while using www as primary on your website, 301 redirecting wonât work anymore, for some reason. It gives me and Error code: SSL_ERROR_BAD_CERT_DOMAIN. tried uninstalling it and installing it again and it only works if i donât use a 301 redirect in my htaccessâŚstrangely
No, this is nothing about rewrite rules.
The certificate has only been issued for lodomus.com and does not include www.lodomus.com.
You have to create a certificate for both domain names.
You should include both domains in one certificate.
E.g: certbot --apache -d lodomus.com,www.lodomus.com
To work around confusion, I would delete the previously created certificates for lodomus.com and www.lodomus.com with the help of the commands certbot certificates (to show which names correspond to which certificate) and then certbot delete --cert-name <name>
root@ns377095:/etc/apache2/sites-available# certbot --apache -d lodomus.com,www.lodomus.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apache2ctl configtest.
Action âconfigtestâ failed.
The Apache error log may have more information.
AH00526: Syntax error on line 11 of /etc/apache2/sites-enabled/lodomus.com-le-ssl.conf:
SSLCertificateFile: file â/etc/letsencrypt/live/www.lodomus.com/fullchain.pemâ does not exist or is empty
The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError(âError while running apache2ctl configtest.\nAction âconfigtestâ failed.\nThe Apache error log may have more information.\n\nAH00526: Syntax error on line 11 of /etc/apache2/sites-enabled/lodomus.com-le-ssl.conf:\nSSLCertificateFile: file â/etc/letsencrypt/live/www.lodomus.com/fullchain.pemâ does not exist or is empty\nâ,)
root@ns377095:/etc/apache2/sites-available#
Try to rename the file /etc/apache2/sites-enabled/lodomus.com-le-ssl.conf to /etc/apache2/sites-enabled/lodomus.com-le-ssl.conf-dis and then rerun the command.
root@ns377095:/etc/apache2/sites-available# certbot --apache -d lodomus.com,www.lodomus.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apache2ctl configtest.
Action âconfigtestâ failed.
The Apache error log may have more information.
apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/lodomus.com-le-ssl.conf: No such file or directory
The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError(âError while running apache2ctl configtest.\nAction âconfigtestâ failed.\nThe Apache error log may have more information.\n\napache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/lodomus.com-le-ssl.conf: No such file or directory\nâ,)
root@ns377095:/etc/apache2/sites-available#
You create one certificate which usually contains your domain name with and without leading www. It is also possible to include other domain names and other sub domains, too. You may include up to 100 names into one certificate.
I only have one name per certificate. It works fine for me. This is a live example with real values. Iâm using:
dehydrated --cron --challenge dns-01 --domain dnssec.co.za
It doesnât matter if you try www.dnssec.co.za or just dnssec.co.za. With or without an http or https, everything redirects to the https entry as âhttps://dnssec.co.zaâ - which is what the certificate matches.
Iâm using apache for over 100+ virtual websites on the one server (all on the same IPv4 and IPv6 address) - so the âvirtual hostsâ section for this one domain looks like:
Thatâs not correct, unfortunately. www.dnssec.co.za has an invalid certificate, and if you visit https://www.dnssec.co.za/ youâll get a certificate error.
Unless, of course, youâre using Chrome, which happens to have some special built-in logic to detect and compensate for this common error.