What is the correct DNS configuration for multiple subdomain names, so that they will work with nginx server blocks and/or Apache virtual hosts?
Example:
Server IP Address: 192.0.2.0 Main/primary subdomain name: vegetable.example.com
Other subdomain names to be served by this rig:
- artichoke.example.com
- bean.example.com
- carrot.example.com
How to properly configure the DNS records to work with Apache virtual hosts or nginx server blocks?
- A record?
- CNAME?
- Alias?
example.comyou declare a NS record for each of the subdomains and within them, you createArecords just as you normally would forexample.com. It's really not difficult, just remember to get the SOA correct. For reverse, you just list all the hosts against the single IP address.*.example.comso any undefined subdomain uses the default IP address. Nginx and Apache don't care if your domain names are defined as A or CNAME records - it's the browser's job to use DNS to resolve the domain into an IP address.