Multiple certificates in one server


#1

I might be doing something wrong here, but I am not able to install two certificates in Apache at the same time.

First one installs fine:
./letsencrypt-auto --apache -d domain1.com

And the second one also installs fine:
./letsencrypt-auto --apache -d domain2.com

But now when I access the first one, domain1.com, I get an Privacy error in Chrome (NET::ERR_CERT_COMMON_NAME_INVALID) "This server could not prove that it is domain1.com; its security certificate is from domain2.com.

So it’s offering the wrong certificate for domain1.com. If I look at the virtual host settings, they seem okay:

/etc/apache2/sites-enabled/domain1.com.conf
SSLCertificateFile /etc/letsencrypt/live/domain1.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain1.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateChainFile /etc/letsencrypt/live/domain1.com/chain.pem

/etc/apache2/sites-enabled/domain2.com.conf
SSLCertificateFile /etc/letsencrypt/live/domain2.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain2.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/domain2.com/chain.pem

#2

SAN certificates are supported. Read the manual (even the quick start guide gives you a pretty big hint)…


#3

Oh, I didn’t realize from the examples that you can put different domains in the same command. I thought you could only put subdomains, since the example used that:

./letsencrypt-auto certonly -d example.com -d www.example.com

So the solution to my problem was:

./letsencrypt-auto --apache -d domain1.com -d domain2.com

Thanks!