To answer the question of “what is web hosting,” think of a website like a house. All houses have two related parts: an address and a piece of land where the house sits. Websites work similarly.
Domain names are like a house’s street address. It’s where people go to visit your website.
Web hosting is like the land where you build your house. This is the space on the Internet where you place your website’s files. Typically, web hosting runs on a server owned by a web hosting company — your web hosting is just a small section of that server.
Because web hosting is such a commonly used term, we usually shorten it to “hosting” — not to be confused with having people over for hors d’oeuvres and cocktails.
Back to websites. If you want to really understand how websites work, let’s use the housing analogy again.
- If you have a domain name but no hosting, it’s like having an address but no land. You can tell visitors where to go, but there’s nothing to show them once they get there.
- If you have hosting but no domain name, you could have built the Taj Mahal, but you have no way of telling anyone how to get to it.
- If you have a domain name and a hosting account — that’s where the magic begins. People go to your domain name/address and see your beautifully built website/house. Amazing.
A quick detour
How does that link happen, though? Much like cities and towns use an agreed-upon system of numbering houses and naming streets, the Internet has a similar agreed-upon system of numbers and names called the Domain Name System, or DNS, to link domains to hosting accounts.
By using DNS, computers can find websites. It’s kind of like a GPS system routing you from your house to a friends’ for a cocktail party. It’s not a perfect analogy, but it’s close enough for you to get the gist of it.
At our destination
So, now that you understand what hosting’s for and how it’s used, we can talk about how it works.
In its simplest terms, hosting is an empty plot of server space waiting to house your website’s files. It doesn’t really “come to life” until you upload your website to it.
For most websites, uploading files to hosting accounts means establishing a File Transfer Protocol (FTP) connection.
In this case, the transfer occurs between the website owner’s computer and the website’s hosting account (remember, a hosting account is just a section of a server, which is a fancy way of saying a computer). After all of the website’s files are on the hosting account, they’re ready to be seen on the Internet.
Opening the right door
Your website is likely to be just one of many on a server, though. How does it know to display your website instead of your neighbor’s?
When the server receives the DNS request, it gets parsed through a Web Server application, which knows which domain names have websites on the server and where their files are. If the domain name has a website on the server, the Web Server application gives the files to the computer requesting them, the website displays, and the peasants rejoice!
However, if the request comes through for a domain name not on the server, the Web Server application returns a 404 error, which means the website can’t be found at this location. Because computers are pretty smart, putting through the same request again is going to return the same error—it’s not analogous to not finding your keys, unfortunately. You can’t keep digging until you finally find what you’re looking for.
Stay a while
This is just the most basic information about hosting accounts. There’s a lot more to learn if you’re interested — FTP users, directory permissions, database connection strings and more. But if you’ve followed this introductory tour, you’re well on your way to being an educated website owner.
Also published on Medium.