Cloudflare is a DNS management service and content delivery network (CDN). Ghost(Pro) users commonly route their DNS through Cloudflare for its support of root level CNAMEs and flexible redirects, known as page rules.

The following steps will walk you through how to setup a root domain or subdomain with your Ghost(Pro) publication, using Cloudflare to manage your domain's DNS records.

Step 1: Connect Your Domain to Cloudflare

The first step for both types of configuration is to create a free Cloudflare account and follow a few steps. There are paid options available but you only need a free account to setup a custom domain with Ghost.

Enter your domain name when creating your new Cloudflare account and it will query your existing DNS records and port them over. Review these records and port any over that are required.

Update your Nameserver (NS) with your domain provider to the NS records that Cloudflare requests during the setup process. If you're unsure where to update this you may need to contact your domain provider directly:

When your Cloudflare Overview shows a status of "Active" you are ready to configure your domain's DNS to point to your Ghost(Pro) publication - this can take a few minutes:

Step 2: Create a CNAME record

Before configuring a custom domain with your publication, decide whether you want to use a subdomain or root domain as the default URL for your site.

What is a Subdomain?
A subdomain is a subdivision of your domain name. For example, if you want to use Ghost(Pro) at blog.ghost.org, “blog,” would be a subdomain of ghost.org. The most common subdomain is “www” e.g. www.ghost.org.

What is a Root Domain?
A root domain, also known as a “naked domain,” is a domain without a subdomain in front, e.g. ghost.org is a root domain.

Whether you use a root domain or subdomain with your publication is a matter of personal preference, however there are different setup steps for each that must be followed.

Subdomain Setup

To use a subdomain with your publication (e.g. www.domain.com) go to your DNS settings in Cloudflare and create the following DNS records, ensuring the Proxy Status is set to DNS Only:

Subdomain DNS Configuration
Record Type Host Value
CNAME www <subdomain>.ghost.io
A @ 178.128.137.126

Root Domain Setup

If you'd prefer to use a root domain (e.g. domain.com), go to your DNS settings in Cloudflare and create the following DNS records, ensuring the Proxy Status is set to DNS Only:

Root Domain DNS Configuration
Record Type Host Value
CNAME @ <subdomain>.ghost.io
A www 178.128.137.126

Step 3: Activate the Custom Domain

The final step to complete your custom domain setup is to go back to Ghost.org and activate your custom domain.

  • Log into your Ghost.org account at my.ghost.org/signin and setup a custom domain in the "Domain Settings" section.
  • Enter the desired domain into the custom domain field on my.ghost.org. Always use the full domain you intend to use, including the subdomain. Omit the subdomain if you're using a root domain.:
  • Activate your custom domain - this can take anywhere from a few seconds to a few hours due to the length of time your DNS takes to propagate.
  • Once activated, you can view your publication by going to the custom domain directly from the browser.

Summary

Great work! 🤓 You successfully setup a root domain and a subdomain with your Ghost(Pro) publication through Cloudflare. Regardless of how a user enters your publication's URL in their browser, they'll always be directed to the correct site.