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:

  1. Register your domain with the registrar of your choice.
  2. Sign in/up for Cloudflare with your domain.
  3. Replace the DNS servers of your registrar with the ones you get from Cloudflare.
  4. 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.

  5. Get started with Github pages as described on this page.
  6. Add an empty file called CNAME containing example.com to your repository.
  7. Push.
  8. 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.