Two domains with same name different tld? Apache VirtualHosts

So I am following the Ubuntu default style of hosting domains on a LAMP server, and as per widely available knowledge, For each domain to be hosted, I have to create a file with same name but with .conf as the extension, inside the following directory.

/etc/apache2/sites-available

So if I have to host example.com I will be creating a file example.conf with all the Apache directives for that specific domain. So far so good, now if I have to host an additional domain with same name but a different extension, say example.org what should I do?

One solution that is occurring to me is add the virtual host config to that same file beneath the previous code, so is this the way to go or is there any "correct" way?

1 answer

  • answered 2018-05-16 05:51 John Mc Murray

    You create your virtual host with the fqdn, eg, example.com.conf and example.org.conf