(Almost) free website hosting
The Dutch are known to be penny pinchers or cheapskates. We quickly feel we’re paying too much and are willing to put effort finding cheaper alternatives for everything.
Being Dutch, this partly motivated me to find cheap hosting too. The primary reason is that I don’t need a LAMP (Linux, Apache, MySQL, PHP) server. I don’t need a server with a lot of software I don’t use or want to spend time configuring.
And so the quest for simple, yet free/cheap hosting begins.
A lot has changed since 2015. Be sure to check out the 2020 update.
If you want to have your own identity, you’re going to register a domain name sooner or later. Long story short; those aren’t free. Depending on keywords in your domain-name and top-level domain (a suffix, like .com), the price of a domain name can vary a lot.
I chose a trusted (Dutch) domain name registrar called Hostnet. My domain costs me €14 a year. I’m sure I’ll survive 5-6 less beer a year, and I’m not worried about paying a beer more or less.
You can’t do much with a domain name only, so we need a place to store and serve files. Being a developer, I am familiar with GitHub and was aware of the existence of GitHub Pages. After some reading, I learned that GitHub Pages are exclusively for static content, where static content means static HTML files. You can still work your magic client-side.
Luckily, there are tools that makes managing content for static sites easier. These are called static-site generators. Jekyll is an example of that, focusing on blogs with built-in GitHub Pages support.
Before we start, you will need a GitHub account. To use GitHub pages create a repository specifically for your website. Your pages will be available on
https://[username].github.io/[project]/. If the project is intended to be the user’s personal site, use
[username].github.io as project name, and it’ll be available on
https://[username].github.io/. Once that’s done, you can clone the repository and add your files. If you’ve never done any of this before, be sure to check out Create A Repo on GitHub.
Step 1: Set Up GitHub Pages Branch
All content on the
gh-pages branch is published.
# Create a branch 'gh-pages'
git checkout -b "gh-pages"
# Or rename branch (master) to 'gh-pages'
git branch -m "master" "gh-pages"
For more detailed information, read GitHub Pages Docs.
If you use Jekyll, you can skip this step and just push on the
master branch. More info on Jekyll and GitHub Pages.
Step 2: Add a CNAME File
CNAME file in the root directory of your project and put your domain name in, without protocol or subdomain. The
CNAME file is a special file to let GitHub know you want to use the defined domain for that project.
Apparently, GitHub Pages supports SSL, unless you have a custom domain. Terrific. Luckily, CloudFlare has a free plan. CloudFlare is a CDN (Content Delivery Network) that has SSL support in their free plan.
You will need a CloudFlare account and add a site by clicking “add site.”
Step 1: Set Nameservers
Go to the DNS settings and below your DNS records you will see a list of Nameservers. These can be set in the settings of your registrar. This forces use of CloudFlare’s DNS settings as opposed to your registrar’s. Note that all DNS settings at you registrar is no longer used, and you may wish to copy those DNS records to CloudFlare’s.
Step 2: Forward to GitHub
Add records as described on Tips for configuring an A record with your DNS provider on GitHub.
At this point, CloudFlare will fetch files from GitHub when requested by a visitor. CloudFlare offers many options for caching, optimisation and a lot more, so be sure to browse through available options.
Free E-Mail Forwarding
The first option I came across was Google Apps. You set a few DNS records to forward mail to Google’s mail server, where the rest is handled. Unfortunately, Google Apps isn’t free anymore.
After several searches, I came across a gem on LowEndTalk, describing how Mailgun can be used to forward e-mail. Mailgun is a service for transactional e-mail. Think of contact forms, or notification e-mails. Mailgun also provides a mail server and the ability to configure a forwarder for incoming mails. The best thing yet? The first 10,000 e-mails a month are free.
Like the other services, first you will need a Mailgun account.
Step 1: Forward to Mailgun
Click on “Add New Domain” in Mailgun. A field will appear. Insert your domain name without subdomain. After submission, you will see four steps of adding DNS records. Follow all steps. Be sure to complete the fourth step as well, as that is required to handle incoming e-mails.
Verifying a domain may take a day or two.
Step 2: Forward E-mail
Go to the “routes” page, create a new route and use the following settings:
Note that the ‘actions’ settings should be whatever e-mail address you wish to forward to.
A handful free services combined make a great starter pack for hosting your own domain. It does require some fiddling if you’re not familiar with this stuff, but it’s well worth the try. This set-up may not be ideal for everyone and I’m sure some of the services mentioned above can be replaced by others.
Five years later, my tech stack changed, but the costs haven’t. Instead of GitHub Pages, I switched to Netlify. Netlify is free for personal use and has tons of options. Instead of Jekyll, I’m using Eleventy/11ty. As for the e-mail service, that one is still going strong. Finally, Mailgun became absolete because Hostnet allows me to forward e-mails.
Was this helpful?🍺 Buy me a beer