So you have developed your website on localhost. It looks great. The client is happy and ready to checkout on your account. But first they want their website live on the internet. Hmmm... that's where issues begin for my dear devs.
I have noticed a lot of developers trip when it comes to DNS issues. The Domain Name System(DNS) is not a well understood despite being a very critical piece of the puzzle of the internet.
Since I work at Uganda's ccTLD registry, I have the rare opportunity to understand DNS beyond the basics. I have written a post on how the internet works which I recommend you read first.
So in 5 simple steps, this is how you would launch your newly developed shinny website.
Register a domain
You register a domain from a domain registrar or registry. .coms are pretty popular and have a lot of registrars such as godaddy, name.com, namecheap, etc.
Since I work with Uganda's ccTLD registry, I would obviously recommend a .ug domain especially for Ugandan startups/companies/organizations. Simply signup for an account at new.registry.co.ug and then search for your domain and pay using mobile money or Paypal. Domains start from $14.
The important thing to note here is that your registry only adds your domain to the internet root servers and that's it. The registrar allows you to specify where you wish to manage your dns records which could be itself or someone else as I explain below.
Add DNS records
When you register a domain from a domain registrar, you have to point your domain to a name server. A name server is simply contact book for your domain. This is where you tell the internet where the website is hosted or who is handling mails for the domain.
There are number of DNS record types you can read about on Wikipedia, but the most important for web developer is the A record which Maps a hostname to an IP address.
When adding or modifying DNS records, the first step is to identify the authoritative name server of a domain.
If you are dealing with an existing domain, then you can find out the domain registrar and name servers by doing a simple whois query. For .coms I usually use who.is and for .ug domains, you could use whois.co..ug. Or you could use command line whois tool if you know linux.
For our domain davidokwii.com, you can tell that domain registrar is name.com. That's where I bought the domain from. However the nameservers are pointing elsewhere; ns1.hataricloud.com and ns2.hataricloud.com. The first name server is called master name server while the rest are called slave name servers. The slaves pick records from the master, so you should be concerned about the master only.
Name servers are hosted at your DNS hosting provider. Now your domain registrar can of course sometimes also host your dns records, but this is not a requirement as is the case with my domain.
Also note that usually -- although not always -- you will pay separately for DNS hosting. If you a register a domain with name.com, and you choose to host dns records with them, it's completely Free. DNS management depending on the provider could be integrated in the cpanel website hosting interface.
Also if you purchase web hosting with a hosting provider such as dreamhost, or i3c, then again, dns hosting is given as part of the hosting package you have paid for.
However, if you choose to host your DNS records with a third party provider for instance Amazon Route 53, you pay $0.50 per hosted zone / month for the first 25 hosted zones. If you go with guys such as DNSimple, you pay $5/month for 5 domains. If you choose i3c, Uganda's registry, you pay $70/year.
Which ever option you choose is completely up to you. Personally, I like to have a dedicated DNS hosting provider where I manage all my domains irrespective of where their websites or applications are hosted. Makes management a little easier.
The final piece of the puzzle is of course website hosting itself. This happens where you specify the DNS A record of your domain which of course is a server sitted somewhere on the internet. This is usually where you login via cpanel or upload website via FTP.
Tip: A note about www:
Now I know some devs will trip over www prefix on their websites. It's important to note that for domain such as www.davidokwii.com, www is actually a subdomain of davidokwii.com. So You need to add A record for both davidokwii.com and www.davidokwii.com. Or add www.davidokwii.com as a CNAME/alias to davidokwii.com. That way if you website visitors type davidokwii.com or www.davidokwii.com, they still arrive at your website.
If you change your website hosting provider, you simply have to go to the DNS hosting provider and update the A record to your domain. In similar way, if you change your DNS provider, you have to recreate DNS records at your new provider.
Links and tools
name.com: .com registry
new.registry.co.ug: .ug registry
who.is: tld whois query
whois.co.ug: .ug web whois
List of dns hosting providers
intodns.com: Domains DNS records query
mxtoolbox: Domain DNS records query
Feature image: intellectualtakeout.org