How this site was built
For a long time it hasn’t been necessary to have your own domain to host content on the internet. Platforms like facebook, twitter, tumblr and others allow you to post your thoughts in a place where others can read them. As these platforms have become ever more popular there has been a shift in power on the internet from independent websites into the hands of these few, huge providers. There’s good news though: the internet has grown up to the point where it’s easy and cheap to host your own content. In this post I’m going to describe how I’ve set up https://richard-towers.com and the trade-offs I’ve made.
What do you need to do to host a site?
The goal of this website is that when someone visits https://richard-towers.com in their browser they will be served the content I have written. To make that happen I needed to do the following things:
- Register the domain name
- Set up DNS to to point requests for
richard-towers.comto a thing which will serve the content
- Handle HTTPS connections
Registering a domain name
richard-towers.com with Namecheap,
which costs me roughly $10/year. There are many other good options for domain
registrars, for example gandi.net. There was some good
discussion of their relative merits
on hacker news
back in 2010.
Since this website always serves the same content regardless of who is reading there is no need for the server to do anything clever - it can simply serve static pages.
GitHub provide a service called GitHub Pages, where they will host your HTML on their servers for free. This service uses a tool called Jekyll, which is a convenient way of writing blog posts in Markdown and having them built into and delivered as HTML.
You can set up a
CNAME record from your own domain (
Set up DNS
The GitHub Pages documentation has instructions for setting up a custom domain. Long story short, tell GitHub about the domain and set up DNS records in your DNS provider.
richard-towers.com I’m using Cloudflare as
my DNS provider. In most situations your domain registrar will offer DNS
provisions for you, but these can sometimes be slow or unreliable. Cloudflare’s
free DNS offering is very good and their service provides some nice features on
top of just DNS.
I’ve configured the domain in Namecheap to point
Cloudflare’s nameservers. Then there’s an A record configured in DNS in
Cloudflare which points at the IP addresses GitHub provides for Pages.
Handling HTTPS connections
Cloudflare have a service which provides free managed TLS.
In the “Full SSL” mode of operation connections between users’ browsers and Cloudflare’s servers go over TLS, and connections between Cloudflare’s servers and GitHub Pages go over a separate TLS connection.
This means Cloudflare are in a position where they could intercept or modify traffic. Since this is just a blog that’s a worthwhile trade-off for the convenience.
Using free services from GitHub and Cloudflare you can host a website over HTTPS for free.
There are lots of other ways to run a website, but this is pretty convenient.