How To Make This Website - Part 1: Domain Name, Server, and DNS
Welcome to the first chapter in how I got this website off the ground. I will be touching on concepts with generality, but my examples will be specific to the tools I used. I am not an expert in web technologies, so feel free to reach out with any errors that you may find.
What Makes a Website?
The term website is not well defined. We use it to describe everything from wikipedia to kanyezone (Click on it. You know you want to). The common trait amongst all websites is the way they are accessed:
- You type a website's name into the address bar in your browser.
- Your browser forms a request for the website on your behalf and sends it off.
- Your browser receives some data in response and interprets it. Whatever comes up in your browser is the manifestation of that interpretation.
So clearly at least two things are necessary for a website: a name and something that responds to requests with data. This name is called a domain name and the responder thing is called a server. Finally we have to associate one with the other through something called DNS.
How to get a Domain Name?
The vocab is kinda confusing and sometimes not well agreed upon. Some people make a distinction between domain and domain name. You can break a domain name into a top level domain (TLD), second level domain, third, fourth, etc. Then maybe there's the host name. Finally all of these and maybe more come together to make a uniform resource locator (URL).
You can certainly read all about these things, but for a simple website it's enough to know that you can go to other websites and search for names that are valid and for sale. These websites are called domain name registrars. They work with ICANN (Internet Corporation for Assigned Names and Numbers) to distribute domain names and keep track of who's who.
I chose namecheap.com as my registrar because they had a great price ($7.06 for one year at checkout) and free WhoIsGuard protection. What is WhoIsGuard Protection? WhoIs is a protocol that let's anyone lookup information about who a domain name belongs to: name, address, phone number, and email. WhoIsGuard protection replaces that information with the information of a faceless corporate entity. For instance, here's my WhoIs results with protection on
Anyway, I found a domain name I liked and bought it.
You might try entering your new domain name in your address bar. At best you'll probably get a page of vague ads, but don't panic. We will associate the name with a machine later, this is just a placeholder provided by the registrar.
How to get a Server?
People have a habit of referring to machines as servers. You've probably seen a "server room" before. This isn't incorrect, but it is misleading. A server is actually a piece of software that runs on a computer. Some computers are specifically built to run server software really really well, but they're not distinct from computers. You can run a server on any PC, Mac, or other definition of a computer. So when people refer to a machine as a server, what they probably mean is that the machine runs server software exclusively. A better name for a machine running a server is host. So what I'll actually cover in this chapter is how to acquire a host with Linode.
Okay you pedant, how do I get a "host" then?
Fair enough. You could host your server on a computer you personally own, though I don't recommend it. If you're a student there's probably an institutional solution available to you for free. But the general, modern solution is to use a host in the cloud. Yeah I said it, "the cloud". All that means is someone else manages the nitty gritty hardware and configuration on a real machine somewhere else, and you pay them to do it. In return, you get an IP address that you can ssh into like any other computer.
Linode.com offers a bunch of instance types (i.e. plans), but for the purposes of this website the cheapest option will do. For $0.0075 per hour (== $5 a month) you get 25GB of SSD space, 1 core, 1GB of RAM, and 1TB of transfer. Sweet! Plus you can always upgrade later.
So pick an instance type and a location where it will be based. I chose California on the off chance it makes west coast performance a little better.
Connect with DNS
When devices connect to the internet they aren't assigned a domain name; they're assigned a number instead known as an IP address. It's DNS (Domain Name System) that records which domain names point to which IP addresses. This way you, Google, or whoever can move your hosting operations to a new machine but your users can just keep on visiting yoursite.com, google.com, or whatever.com.
However it's up to you to make sure this association occurs. DNS works thanks to name servers. Name servers basically hold lists of domain names and associated addresses; it is their job to respond to requests for name to address translation and tell other name servers about updates they encounter.
In my case both the registrar (Namecheap) and the host (Linode) have an account of what name servers to use, but they default to their own respective name servers. To solve this, you either tell the registrar to use the host's name servers, or vice versa. I chose to tell Namecheap to use Linode's name servers because Linode has knowledge of your hosting IP address, so it's a little easier.
Tell the Host's (Linode) Name Servers Your Domain Name
First sign-in to linode and go to the Linode Manager where you will click on the DNS Manager tab. Then click "add a domain zone". This will bring up a dialog; enter your domain name, email, and choose the "Yes, insert a few records..." radio button. If you have multiple Linodes make sure the correct one is indicated in the drop-down menu. Finally click "Add a Master Zone". This will produce a results table for the domain zone you just created. Under "NS Records" there's the list of Linode's name servers (ns1.linode.com, ns2.linode.com, etc) that Namecheap needs to know about.
Congrats! Now Linode's name servers know that your new domain name should take users to your new host.
Tell the Registrar (Namecheap) to Use the Host's (Linode) Name Servers
Next visit namecheap and sign-in. Go to your Dashboard and click on the "Manage" button to the right of your new domain name. Under "NAMESERVERS" choose "Custom DNS" in the drop-down menu. Click "Add Nameserver" and fill the field with a Linode nameserver (e.g. ns1.linode.com). Repeat this until all of them appear under "NAMESERVERS".
And just wait! Namecheap will start propagating this update through the internet automatically.
You've completed Part 1! There won't be visible results yet, but Namecheap will be busy telling other nameservers about the update through a process called propagation. This takes some time, but by the time you're ready to visit your domain name in Part 2 it will hopefully be completed and whatever nameservers you are using to browse will resolve your new domain name correctly.