Use Cloudflare CDN in Wordpress

Page content

How to use Cloudflare CDN with Wordpress

Wordpress is the most used and popular CMS for creating websites. It is well known for its flexibility and ease of use. You can use Wordpress to create several kinds of websites including portfolio websites, blogs or news sites, ecommerce sites and so on. Wordpress also offers a vast array of plugins and themes that can be used to give the website your desired look and make it function as expected.

If you have a blog or website created using Wordpress, there are a few things you would likely need to be concerned about. Two most important concerns for Wordpress users are speed and security. There are several caching and other speed management plugins to be used to manage Wordpress speed. However, to gain speed in real terms and improve your lighthouse score and loading times, you will need a cdn.

There are several cdn brands in the market that can speed up your wordpress blog and also offer several security features to keep it secure from attacks. One of the leading names in Wordpress speed and security is Cloudflare.

Cloudflare is not just a cdn that you can use to serve content to users across the world from their nearest locations, but it also includes security and other performance optimization features. These features can help you load your site faster, keep it secure from attacks and other types of security vulnerabilities. Cloudflare has introduced several new features that can substantially improve Wordpress performance including the Automatic Platform optimization feature, which can be easily set to overcome issues that might throttle Wordpress speed.

The best thing about Cloudflare is that you do not always need to pay to speed up your wordpress site. You can improve DNS speed and minimize js, html and css with a free cloudflare plan. The paid plans starting $20 include more features which can help you manage images and speed up and secure your Wordpress site further. The automatic platform optimization feature can be utilized for $5 monthly only which will include all the major speed optimizations and can substantially improve page loading times and core web vitals.

Why use Cloudflare with Wordpress?

If you are still concerned about whether Cloudflare is your best option for CDN and DNS management, then rest assured that Cloudflare has the best global footprint and apart from speeding up and securing your website, it helps reduce the consumption of your server resources.

Cloudflare uses Anycast routing to ensure that the visitors are served content from the nearest datacenter. Its global network covers more than 190 cities and more than 90 countries. It stands out from the legacy CDNs in terms of both website speed and security features.

Once you have activated Cloudflare on your website, it will cache static content by default. Cloudflare CDN automatically caches more than 35 file extensions and the list can be further extended using page rules. However, Cloudflare does not just speed up and secure your website, it also optimizes content based on device, browser and bandwidth needs. It brings your content closer to your visitors so you visitors can have a better experience. Cloudflare caches static content and accelerates dynamic content. On top of all, it is affordable and its infrastructure is designed to outperform the legacy CDNs.

How to use Cloudflare with Wordpress?

Wordpress-Cloudflare basic setup is easy and does not require any technical knowledge. By using cloudflare, you do not just get the benefits of a world class cdn but also that of premium DNS. According to DNSperf (a DNS performance monitoring website), Cloudflare offers the fastest DNS.

Create a free cloudflare account

To start using Cloudflare with your Wordpress blog, you must first get a free cloudflare account. Login after creating your account to add your website. Click on get started and then add your website to the field where it says enter your domain. Click on continue and you will be taken to the next page where it will ask you to select a plan.

You can select the free plan and proceed if you only want Cloudflare to manage your DNS, provide cdn services and other free speed optimizations. The paid plans include additional features and if you want to manage images on your blog or need those extra features like cache analytics, APO plugin, automatic mobile optimization and enhanced bot mitigation, you can buy the pro plan for $20.

Review DNS and Change Nameservers

Cloudflare CDN

Select the right plan and click continue. In this tutorial, we will continue with the free plan. Now, Cloudflare will scan your existing DNS records. It will import the existing DNS records and if you want to add more DNS records you can add them here by clicking on add records. Review your DNS records in Cloudflare and if everything appears fine then click on continue.

Now is the time to change nameservers and replace your existing nameservers with those provided by Cloudflare.

Cloudflare generally provides the following nameservers:

  • ian.ns.cloudflare.com
  • lana.ns.cloudflare.com

How to change your nameservers?

Changing nameservers is an easy process and will require you to go to your domain registrar’s account. Here, we will show you how to change nameservers in your Godaddy account. Suppose, you have bought your domain from Godaddy, you can login to your Godaddy account and then go to the domains sections and select the concerned domain.

Now, click on manage DNS and then on the next page click on nameservers. You will see two or more existing entries there, which need to be changed to the ones provided by Cloudflare. Click on change nameservers and then select “I will use my own nameservers.”

Change nameservers godaddy

Remove the previous nameservers and replace them with the Cloudflare nameservers and save. Allow if Godaddy asks permission to update the nameservers. Now, you have changed your nameservers. It will take some time for the DNS to propagate and meanwhile you can change the other settings inside Cloudflare account. If you check using whatsmydns.net, you will see that the new NS records (nameservers) have started propagating.

Setting Cloudflare Speed Up and Secure Your Wordpress Blog

Now, get back to your cloudflare account to carry on from where you left. It usually takes some time for cloudflare to start functioning on your website after you have changed the nameservers.

Once inside the Cloudflare account, you can click on check nameservers. Cloudflare will keep checking the nameservers and inform you through mail if Cloudflare is now active on your website. Meanwhile, let’s proceed to the next step, which is to set up Cloudflare to protect and speed up your website.

In the next step, you are taken to a quick start guide that will help you do a quick set up. Here, you will select the following:

  • Automatically HTTPS Rewrites
  • Always use HTTPS
  • Brotli

Save and move ahead. Now, you can explore the rest of the settings inside Cloudflare. Inside the security sections, you can change the security level for your website and adjust to low, medium or high according to your need. These features can be changed from the security settings.

Now, move to the SSL/TLS settings and change the settings to full strict from full.

You can manage the firewall rules (five free rules in the free plan) from Security -> WAF.

It is now time to speed up your website using Cloudflare. Go to the speed settings in the sidebar and from there go to optimization and select content optimization. From here you can enable Brotli (must be already enabled) and autominification. In the autominify settings, you can select what content Cloudflare must minify including CSS, JS and html.

For best speed, you must select all the three. However, you must first test it and if you see anything breaking on your website, you can change the settings for CSS or JS.

Cloudflare autominify

Inside the caching settings, go to configuration and leave the default selection ‘Standard’ on for caching level. If you want, you can increase or decrease the Browser cache TTL. 4 hours is generally suited in most cases. You can switch on the ‘Always Online’ feature, in which case, Cloudflare will show cached copies of your webpages to visitors if your website is offline for some reason.

If you want your Wordpress blog to load even faster and achieve lower TTFB, you can purchase the Automatic Platform Optimization for Wordpress for only $5 a month which includes all the necessary Wordpress speed optimizations.

A few last words:

Whether you are operating a simple wordpress blog or an ecommerce website, you want your website pages to load faster so your visitors can have a great experience. Cloudflare can significantly speed up your website and if you are using Wordpress, Cloudflare also offers Automatic Platform Optimization features to enhance speed and security.

Cloudflare provides you free cdn and has one of the most extensive global footprint of all CDNs. Even with a free plan, you can enjoy the speed and security features. Its global distribution network serves content from the nearest datacenter resulting in significantly faster loading times. If you do not have Brotli compression active on your server, you can get the benefit of Brotli using Cloudflare.

Using Cloudflare offers several benefits including higher speed, better security and lower pressure on the origin server. It is also a no optimization CDN which means apart from switching on or off a few features, you will not need to make any extensive changes. You will also enjoy faster DNS with Cloudflare. So, take your website to Cloudflare and get ready to experience higher speed and security.