How is it possible to host a website that can support a billion pageviews per month for pennies? With the help of Cloudflare and Hugo, you too can place content on the internet where it will be hosted with unlimited requests and bandwidth for free. You just need to buy the domain!
You’ll need four things to complete this project:
- A GitHub account (free)
- A Cloudflare account (free)
- A domain name (~$3-20/year)
- Your website code ( contact for quote )
The GitHub account is required to host a copy of your website’s content, the raw stuff your website will be generated from. When the content is modified in GitHub, Cloudflare can automatically watch it and update your website.
The Cloudflare account will be used to connect to GitHub, assemble your website, and deploy it to their servers around the globe. While this is definitely a deal where you are the product, free global content distribution on the Cloudflare network is nigh unbeatable in terms of speed and reliability.
You must purchase a domain name sutiable for your personal brand. Domain names can be had for as little as $3.16 per anum on the .win
domain, ~$10-15 for .com
, and up to $40 for .io
, depending on who you register the domain with. You’ll be able to register a domain with your cloudflare account (highly recommended for this project,) but if you already have a domain registered with another provider, it is easy to point it towards Cloudflare’s DNS servers (more on that later.)
Cost of a domain per month:
.win -> 3.16 ÷ 12 = 0.263
.com -> 9.15 ÷ 12 = 0.762
.biz -> 13.68 ÷ 12 = 1.140
Finally, you’ll need an actual website to deploy. Static sites are so cheap to deploy because they do not require a backend to assemble html on the fly. I’ll touch on how to build a static site, but I’d also be happy to build you a custom system with all the tricks and improvements I’ve found over the last several years.
Let’s get into it.
Get a Cloudflare Account
Cloudflare is the backbone of this project. Many companies provide free static site hosting, but none have the power and scope of Cloudflare. Simply sign up on the Cloudflare website to begin your journey.
Here is some of the marketing for the product we’ll be using, Cloudflare Pages , if you aren’t convinced yet. Above and beyond hosting, Cloudflare provides a number of extremely useful services for a web developer operating in this digital day and age.
Get a GitHub Account
Static sites are bundles of content and instructions for how to turn that content into a fully styled and navigable website.
…but the content and instructions have to digitally exist somewhere.
You can think of GitHub as the storage for this project. There is an interactive sign up page to help you create an account. GitHub was specifically chosen for this project because of its rich integration with Cloudflare which makes deployment simpler than snapping your fingers.
Buying a Domain Name
In your Cloudflare dashboard, under Domain Registration, there is a convenient page to Register Domains. Simply search for the page name you wish to use and purchase a domain. I’ll explain how to hook everything together in the Deploying to Cloudflare section.
For now, enjoy buying a domain name. Do it now!
It’s better to seek a domain name before you start building your website so the site’s branding and look can be tailored to the name it will be accessed with. You wouldn’t want to build a website planning to use the domain awesome.party
only to find it is being sat on by some firm and will cost thousands of dollars and plenty of pain to acquire.
Managing your Site in Github
When you upload your website’s source code to GitHub, the website will provide version control to track the changes you make. This means that if you ever want to ‘go back’ you have the full history of changes to your site to look through. Nothing will ever be lost unless you choose to delete the repository or we experience a coronal mass ejection, in which case I hope you’ve got a blue collar gig you can turn into a career.
If you are not familiar with git, that is fine. Familiarity with this venerable version control system is excellent but not neccessary to enjoy editing your website in Github.
At this point in the process you must have a static site ready, or build it to the point where it is deployable. As I have said frequently, Hugo is my tool of choice, but there are plenty of other static site generator tools out there written in a variety of languages, from the venerable Jekyll to the abysmal Gatsby and so on. If you need some professional help putting a new Hugo site together, let me know.
Perhaps the one major hurdle for a non-technologically-inclined person wading into this space is learning how to edit documents in Markdown. Online editors for static sites like forestry.io exist, but are not being improved as they do not generate a lot of revenue. Learning how to edit and manage your website as a bundle of text and files is probably best.
Deploying to Cloudflare
Alright, you’ve got your Cloudflare account, Github account, a domain name, and a Github repository which contains your static site. You are now ready to deploy the static site to the domain you purchased!
At this point you’ll be asked to install the Cloudflare Pages app to your GitHub account. Say yes. This is neccessary to power the automatic deployments we want.
Only give Cloudflare access to the repository it needs: the one you have already created for hosting your website.
For an in-depth guide on how to deploy your website on Cloudflare Pages, check the official cloudflare documentation on this topic. Cloudlflare has also published over 30 guides for how to publish pages using specific static site generators including Hugo .
During the deployment, you will see an option to add a custom domain , where you can select the domain you previously purchased via Cloudflare. If you purchased the domain outside Cloudflare, you can point it towards Cloudflare’s DNS servers to easily manage it there.
Wrap Up
You’ve done it. The website is up! Whatever you write now can easily be served to the entire world, and you’ve done it for mere pennies per day.
What I cannot tell you how to do is how to effectively market your content to the point where it reaches one billion people, but hey, I’ve got a Computer Engineering degree and not one in business or marketing!
Please leave a comment if you think I’m wrong or have a reasonable question to ask, or shoot me an email if you need help or would like some custom work done!
Enjoy conquering the world, King.
Comments