Configuring multiple domains on Apache with a few virtual hosts

Currently I have setup a global certificate with certbot-auto. The script figured out what is my main domain but omitted virtual hosts that has different domains (the wizard just shown option for domain.pl and www.domain.pl).

So assuming I have websites working on:

www.domain.pl
www.different.pl
www.other.eu

What would be a best way to set this up? Can I have a single certificate for all of them? Each has a separate VH now, but I might put them on single VH later (to let Drupal figure out domain routing).

Would this generate and install a single certificate valid for all above domains?
./certbot-auto -d www.domain.pl -d domain.pl -d www.different.pl -d www.other.eu

Or do I need to generate separate certificates and setup VH manually?

System: CentOS 6
WebServer: Apache 2

Yes, you can create a single certificate for up to 100 Fully Qualified Domain Names.
I notice that all of the names you listed start with www. You should consider if you also need the names without this prefix and if so ask Let’s Encrypt for both. Even if visitors are redirected instantly their web browser will check the name.

2 Likes

Having the same site bot with and without www. is not a good practice for search engines: they might index both pages and notice that they are duplicate content.

You might consider therefore that, whatever your visitor types, it always goes to only one of both.

this can be solved easily at the DNS level, where usually you would have an “A” record for one (or both) of the domains. Just keep the A record for your preferred ulr, than delete, if present, the A record for “the other”, and creat for it instead a “CNAME” record that would point to the good one.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.