CloudFlare CDN Setup For WordPress On Google Cloud

In this tutorial you will learn how to Cloudflare CDN setup for your WordPress website on Google Cloud. When configured correctly, Cloudflare CDN can provide huge performance and security benefits for your website.

Benefits of using a CDN

A CDN is a network of globally distributed servers that store and distribute your website’s content.With a CDN configured, your website’s content will load quickly for all users, regardless of their geographic location.Without a CDN, your website is served from a single server, meaning slow load times for international visitors. With a CDN, your website is stored and served from many servers around the world, meaning consistently shorter load times for visitors.

CloudFlare CDN Setup

If you don’t want to install your own SSL certificate, it is possible to use Cloudflare’s SSL service with your CDN. You will have the option to apply this setting in step 3 of this tutorial.

Learn more about the advantages and disadvantages of using Cloudflare’s SSL service with your CDN by clicking here.

There are 6 steps in this tutorial:

  • 1. Create a Cloudflare account
  • 2. Change domain nameservers
  • 3. Configure Cloudflare crypto settings
  • 4. Optimize Cloudflare caching settings
  • 5. Test website performance
  • 6. Additional considerations

1. Create a Cloudflare account

In your web browser, navigate to the Cloudflare signup page.

CloudFlare CDN Setup

On the signup page, choose an email and password to use for your account, and click the Create Account button.

CloudFlare CDN SetupCloudFlare CDN Setup

After creating an account, click the + Add a Site button to configure your website with Cloudflare.

CloudFlare CDN Setup

Click the Next button to query your DNS records.

CloudFlare CDN Setup

Select the FREE option to get started with a free account, then click on the Confirm Plan button.


CloudFlare CDN Setup

After Cloudflare has verified your website’s DNS records, click the Continue button.

CloudFlare CDN Setup

Copy the two nameservers that Cloudflare provides and paste them into Notepad – you will need these in the future steps.

CloudFlare CDN Setup

2. Change domain nameservers

Visit the domain name provider where you registered your website’s domain name. Namecheap is used in this example, but there are hundreds of other domain name registrars to choose from.

CloudFlare CDN Setup

Once you’ve logged in to your domain name registrar, navigate to the settings page of the domain that you want to configure. Select the Custom DNS option, then paste the two Cloudflare nameservers that we copied from step 1 of this tutorial.

CloudFlare CDN Setup

3. Configure Cloudflare SSL settings

Go back to your Cloudflare homepage and click on your website.Click on the Crypto icon at the top of the page to configure your Cloudflare SSL settings.

CloudFlare CDN Setup

On the Crypto page, select the Full (Strict) SSL setting if you already have SSL configured on your website. If you want to use Cloudflare’s SSL, choose the Full SSL setting.
CloudFlare CDN Setup

4. Configure Cloudflare caching settings

Next, click on the Caching icon at the top of the page to configure your caching settings.

CloudFlare CDN Setup

Set your Browser Cache Expiration setting to 1 month, or choose Respect Existing Headers if you’ve already configured caching on your origin server.

CloudFlare CDN Setup

5. Test website performance

Now that you’ve configured Cloudflare CDN Setup , the next step is to check that it is working properly. In your browser, open a new tab and visit GTMetrix. Then, enter your website’s URL in the search field and click the span style=”background-color: #eee”>Analyze button.

CloudFlare CDN Setup

First, under the PageSpeed tab, check that the Leverage browser caching criteria has a high score.

CloudFlare CDN Setup

Next, navigate to the YSlow tab and check that the Use a Content Delivery Network (CDN) and the Add Expires headers criteria are both met.

CloudFlare CDN Setup

6. Additional considerations

Combining Cloudflare CDN Setup and SSL

Cloudflare offers three separate settings for handling your website’s encryption with SSL. The three settings are Flexible SSLFull SSL, and Full SSL (Strict).

Full SSL (Strict) provides the highest level of SSL security, however, it requires that you setup SSL on your origin server beforehand.

1. Flexible SSL

Flexible SSL is the easiest setting for configuring Cloudflare’s SSL with your website, but unfortunately does not encrypt the connection between your website’s server and Cloudflare (your website will still show the green padlock).

CloudFlare CDN Setup

2. Full SSL

Unlike Flexible SSL, the Full SSL setting provides encryption between your server and Cloudflare. The only drawback is that your connection between your server and Cloudflare isn’t authenticated.

CloudFlare CDN Setup

3. Full SSL (Strict)

Out of the three available settings, Full SSL (Strict) provides the highest level of security. Unlike Full SSL, the Full SSL (Strict) setting ensures than the connection between your website’s server and cloudflare is authenticated with a signed SSL certificate.

CloudFlare CDN Setup

However, if you want to take your security a bit further, you can use the Full SSL (Strict) setting. This setting requires that you already have SSL configured on your server (with valid certificates).