Static Site Hosting with Github Pages and Cloudflare
How I bootstrapped this blog and how you can do it, too. Let’s assume you want to setup static hosting on example.com
:
- Register your domain with the registrar of your choice.
- Sign in/up for Cloudflare with your domain.
- Replace the DNS servers of your registrar with the ones you get from Cloudflare.
- In the Cloudflare dashboard under DNS add two entries:
CNAME example.com yourusername.github.io
CNAME www yourusername.github.io
Make sure that you click the Cloudflare icon for both of these entries to turn them on.
- Get started with Github pages as described on this page.
- Add an empty file called
CNAME
containingexample.com
to your repository. - Push.
- Profit!
At this point you probably want to get started using jekyll
or start using a ready made theme and modify that to your likings.
On the Cloudflare side you can tune some settings. I would recommend to turn on caching via pages rules and also turn on minifying under the Speed tab.
Now, you have a static site speed up by Cloudflare which you can use for blogging or just for some personal info.