Managing Custom Domains for Github Pages via Linode

Github Pages is a service provided by Github which can be used to host static blogs. In this article I walk through the basic setup of Github Pages and how to correctly configure a custom domain via the Linode DNS manager.

Goals

  • Enable comments (via disqus)
  • Receive mail (managed by google)
  • Access the github site via http://www.domain.com
  • Access the github site via http://domain.com (will redirect to www.domain.com)
  • Configure the site optimally so that github does not throw DNS related warnings.
  • Add comments

Basic Setup

Lets start by creating a blog in github. Fastest way to do this is to clone the project at «Insert template area here» I created this project which contains everything we need to get started, but uses placeholders instead of dummy content (so you won’t have to remove a bunch of fake articles).

CNAME File

In the root directory of the project you can find a blank file called CNAME Assuming your site is called www.domain.com Add the following as the first and only line in the file:

www.domain.com

Adding this file ensures that github knows to serve this repository up for that domain.

A Records

We then need to set the A Records in Linode up to ensure that domain.com resolves to the github primary and secondary servers. To manage A records, go to the DNS Manager, edit the domain, and ensure that the A/AAAA records table looks exactly like it does below. (2 records only, both as shown).

A/AAAA Records    
Hostname IP Address TTL
  192.30.252.154 Default
  192.30.252.153 Default

CNAME

To allow www.domain.com to work, we must add the following CNAME record which should point to the repositoryname.

CNAME Records    
Hostname Aliases to TTL
www yourreponamehere.github.io Default