4

I have the domain example.com with the subdomains : www.example.com and a.example.com. Let's suppose that I can't buy a wildcard certificate but, I bought the certificates for example.com and www.example.com. Now I bought the certificate for a.example.com. The site and it's subdomains are in the same folder, using one Apache vhost file and subdomains are defined as aliases.

  1. Can I merge the certificates into one file ?
  2. What if I used the same key, csr files to generate the certificates ?
  3. Is the ONLY solution to declare the sites in two different vhosts ?
1
  • My scenario is similar, default virtualhost can be branded, e.g. www.cust1.brand.com and www.cust2.brand.com, main site is on www.main.com (as well as www.brand.com, brand.com and legacy.example.com) and main.com... (Code looks at Host header to brand site) Tens of identical VirtualHosts seems impractical to maintain... Jul 4, 2017 at 9:50

2 Answers 2

6

Can I merge the certificates into one file?

No, only one leaf certificate is supported. Although from version 2.4.8 the SSLCertificateFile directive allows multiple certificates in that file, that is only to include intermediate CA certificates, sorted from leaf to root, as a replacement for the SSLCertificateChainFile directive.

The SSLCertificateFile directive can be used multiple times (referencing different filenames) when an RSA, a DSA, and an ECC based server certificate is used in parallel. But you can't use multiple SSLCertificateFile directives to load a certificate for the ServerName and an extra for the ServerAlias.

What if I used the same key, csr files to generate the certificates?

Still no.

Is the ONLY solution to declare the sites in two different vhosts ?

If you have two certificates you need two SSL VirtualHosts.

1

Can't merge certificates. But you can do it other way. For Apache, you can use mod_macro.

I've got 50 domains (like a.com, b.com, c.com, d.com, etc) based on the same wordpress code directory. While convert to https, every domain has its own certificate and private key files. I don't want to copy & paste & change the VirtualHost block codes for 50 times.

By mod_macro I don't need to do the VirtualHost block 50 times.

I've answered in another similar question: Is it possible to generate a variable for SSLCertificateFile from HTTP_HOST (or something similar)?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .