DNS lookup process
So how does DNS actually work? First, the domain name needs to get translated into your servers public IP address. DNS matches human-friendly domain names like example.com to computer-friendly IP addresses like 184.108.40.206. This happens in a special text file called a zone file, which lists domains and their corresponding IP addresses (and a few other things). A zone file is like a phone book that matches names with street addresses.
Here's how the DNS lookup process works:
- You type a domain name like example.com in to the address bar.
- Your computer connects to the Internet through an Internet Service Provider (ISP).
- The ISP's DNS resolver queries a root nameserver for the proper TLD nameserver. In other words, it asks the root nameserver, "Where can I find the nameserver for .com domains?"
- The root nameserver responds with the IP address for the .com nameserver.
- The ISP's DNS resolver visits the .com nameserver, using the IP address it got from the root nameserver. It asks the .com nameserver, "Where can I find the nameserver for example.com?"
- The .com nameserver responds with the IP address for the example.com nameserver.
- The ISP's DNS resolver visits your domain's nameserver and reads the zone file.
- The zone file shows which IP address goes with the domain.
- Now that the ISP has the IP address for example.com, it connects you to your server.
- Apache handles everything after that, ensuring that the correct files and folders get displayed in your visitor's browser.