Okay, after initially setting up my test server, with a few virtual servers using Virtualmin, behind a NAT to just get things up and running to learn how this works, the next stage is learning how to make the virtual servers’ websites publicly accessible to the Internet.
I have the server machine now sitting on the end of a static IP address and I have some spare domain names for testing purposes. I will be hosting a few virtual servers on this server and each one will have its own separate domain name.
Do I simply create an “A” record for the domain name that points to the server’s static IP with the company I bought the domain name from and that’s it? That is, Apache will pick up on the domain name and serve the corresponding named virtual host, so I don’t need to do anything more?
Or do I need to be running a DNS server myself, with entries for each domain name / virtual host, and then I point the domain name at my server’s name servers to resolve which one is which?
I’ve not done this before. I’m not exactly sure how the DNS records need to be set up to make this work and whether I do or don’t need to be running my own DNS server or not. Virtualmin will set up the required DNS records for me if I run my own DNS server, but do I even need to do this in my situation?
For example, with Virtualmin, I’ve created the virtual servers “website1.com” and “website2.com” on the server. I have also purchased the domain names “website1.com” and “website2.com” from a registrar and can edit the DNS records for those domain names.
How do I hook it up so that when someone types “website1.com” into their browser, Apache will end up serving the “website1.com” virtual host to them? And, of course, similarly with “website2.com” but serving them the “website2.com” website instead.
Just an “A” record that points to that static IP address? These are top-level domains. Do I need a DNS server only for subdomains or also for top-level domains as well?
Basically, I’m just generally confused as to how this DNS stuff is supposed to be set up, as I’ve not done it before.