Root Domain Setup Using Cloudflare
What is Cloudflare?
Cloudflare is a DNS management service and content delivery network (CDN). It provides a great deal of tools for managing your DNS and super charging your site. Ghost is partnered with Cloudflare, and all Ghost(Pro) blogs automatically receive the benefits of Cloudflare’s CDN.
Creating a Cloudflare account
- To create a Cloudflare account, go to https://www.cloudflare.com/a/sign-up and follow the prompts to get started.
- At the top of your Cloudflare account, click Add Site
- Enter your domain into the field provided and click Scan DNS Records
- When the Cloudflare DNS scan is complete, click Continue
- Verify that all of your DNS records are listed with Cloudflare and click Continue
- Select the “Free” plan and click Continue.
- Next, update your NS records with your domain registrar to the records that Cloudflare requires and click Continue.
Once through the Cloudflare setup process, you should be able to manage your domain through Cloudflare.
Connecting your domain to Ghost(Pro) - Root domain setup (yourdomain.com)
- Click DNS from the icons at the top of your Cloudflare toolbar.
- Add the following DNS record to point to your domain at your Ghost(Pro) blog:
@ CNAME yourblog.ghost.io
- Create a second DNS record to point the subdomain to the root domain:
www CNAME yourdomain.com
Redirect the subdomain to the root domain.
- Click on Page Rules
- Click Create Page Rule
- Enter the subdomain version of your domain in the first URL field, http://www.yourdomain.com/*
- Click +Add a Setting
- Select Forwarding URL from the dropdown that appears.
- Select 301 - Permanent Redirect from the Select Status Code dropdown.
- Enter in http://yourdomain.com/$1 as the destination URL.
- Click Save and Deploy
Update your Ghost.org publication settings
With the Cloudflare DNS records added, the final step to setting up your custom domain would be to update Ghost.org.
- Log into your ghost.org account.
- Access your publication management settings by clicking the dropdown menu arrow to the right of "Owner"
- Select Domain from the list of options.
- Enter your domain into the Custom Domain field.
- Click Save.