Setting up a GitBook for a Custom Domain

If you haven’t already looked at the GitBook platform, you definitely should.  There are a number of very interesting ways that you can use this for creating easy-to-use documentation sites using simple markdown and the hosted platform.  SaaS FTW!

Let’s view a simple way to add a custom domain name to an existing GitBook site.  For this example, I’m using:

Start by looking at your existing GitBook site under the Settings | Domains section:

01-gitbookdns-empty

The first thing to do is to make sure that you get your DNS configured.  Open up your AWS Route53 console, select the radio button for your domain, and click the Go to Record Sets button:

02-route53-zone

Create a new CNAME entry using the Create Record Set button.  Choose www for the Name field, CNAME as the Type, and for the value, choose www.gitbooks.io to redirect the request: 03-route53-www-cname

You also need to set a redirect for the root domain which is turbonomicguidetothegalaxy.com in this case.  That “naked” domain redirect can be done in some DNS hosting platforms using a URL Redirect, however that is not available with AWS Route53.  Luckily, I’ve covered how to use S3 and Route53 for simple redirects in the past here.  You will just need to configure the redirect of the root to www.turbonomicguidetothegalaxy.com in the S3 configuration.  Route53 will take over from there.

On your GitBooks settings page, enter the newly assigned domain name to match the changes you just made in Route53.  This is done using the Domain for content field: 04-gitbook-domain-set

Save the settings and you’ll be given a confirmation on screen:

05-gitbook-domain-completed

This is where the wait time comes in.  DNS can take a little while to update across all of the internet, so it’s best to wait about 15 minutes to complete the last step.

To confirm your changes, type in the domain name for your GitBook that you have just configured and watch the magic happen!  The sample you can see at TurbonomicGuideToTheGalaxy.com is a simple GitBooks site that is being updated.  Now all that I have to do is give out the FQDN and update my book as I go.  If the book repository is updated, the redirection can be configured at the new repo and you never have to worry about people having to update their links and bookmarks.

06-gitbook-domain-confirmed

Enjoy!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.