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 set up a root domain or subdomain with your Ghost(Pro) publication, using Cloudflare to manage your domain's DNS records.
Regardless of how a user enters your publication's URL in their browser, they'll always be directed to the correct site.
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 set up a custom domain with Ghost.
Enter the domain name that you own, 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.
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.
Once active, to access your domain's DNS records in Cloudflare, click DNS from the admin menu on the left.
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.
DNS Only
When using Cloudflare it is important to have all records you set for Ghost, to a Proxy status of DNS only.
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:
Subdomain DNS Configuration | |||
---|---|---|---|
Record Type | Host | Value | Proxy status |
CNAME |
www |
[subdomain].ghost.io |
DNS only |
A |
@ |
178.128.137.126 |
DNS only |
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:
Root Domain DNS Configuration | |||
---|---|---|---|
Record Type | Host | Value | Proxy status |
CNAME |
@ |
[subdomain].ghost.io |
DNS only |
A |
www |
178.128.137.126 |
DNS only |
Step 3: Activate the Custom Domain
Log in to your publication's Ghost Admin area, and go to the Ghost(Pro) > Domain settings.
Click Setup, and enter your custom domain into the custom domain field, then click Activate, to activate your custom domain.