, ,

Speedup & Setup WordPress with Azure CDN

Azure CDN WordPress Configuration Cover image

What is a CDN?

Definition of Content Delivery Network (CDN)

A Content Delivery Network (CDN) is a geographically distributed network of cloud servers that help in content distribution to users with minimal delay. A CDN achieves this by bringing specific content closer to the geographical location of the users (for example: the visitors of your website). Therefore, companies that provide CDN services build up strategically located data centers that are called Point of Presence (PoPs). CDN services also include caching to accelerate webpage loading times and reduce bandwidth consumption.

How does a CDN work?

Let's specifically address the case of running a WordPress website that includes a webshop. Your website contains a lot of information - some stored in databases, others stored as files (HTML, CSS, JavaScript, images, more). In addition, the website contains individual business logic.

Let's assume your website is hosted in Germany. Visitors to your website from Germany expect very short loading times, as the data does not have to be transferred over long distances. However, if your users are located further away, for example in Canada, a lot of data has to be transferred over a long distance.

A CDN aims to reduce the amount of data that has to be transferred from your server (in this example from Germany). Instead, CDN-compatible data (static data that does not change) is copied to globally distributed servers of CDN providers that are geographically closer to the visitors. This reduces the load times of said data, sometimes significantly, depending on the visitor's distance from the original source data center. A CDN service is compatible with static data, i.e. images, HTML files, CSS information and more. Business logic and information from databases are not touched by a CDN service.

To summarize: If a user from Canada calls your website hosted in Germany, static data is loaded from a data center in Canada (CDN service) and business logic and data from database is retrieved from Germany.

So a CDN service serves two goals in particular:

  • Reducing the load on your server (in the example in Germany)
  • Increase load times for users (in the example in Canada)

Configure Azure CDN for WordPress

With this guide, you'll learn how to use Azure CDN to greatly accelerate your WordPress website - all over the world and through Microsoft's large and global server landscape. Azure CDN is characterized by a reputable provider (Microsoft) and low entry prices and barriers. You can try it for free.

Login to Azure Portal

Azure CDN WordPress Configuration Azure Portal Login

To configure Azure CDN, you first need a Microsoft account. Log in to the Azure portal with it.

Microsoft Azure CDN is a paid service. Therefore, a subscription must be stored in Azure (Microsoft's cloud environment), which can be used to debit the costs (details on costs). If you do not have a subscription yet, you must set one up. As a rule, Microsoft offers a 30-day test phase with 200 US dollars in credits, which can be used once per Microsoft account.

Register Microsoft.Cdn Resource Provider

Azure CDN WordPress Configuration Azure Register CDN Resource Provider

Azure CDN might not be enabled for the subscription by default. You will probably have to activate it: Navigate to Subscriptions and enter your subscription that you want to use for billing with Azure CDN. Within the subscription, select the menu item Resource providers and search for Microsoft.Cdn. Then, register it and wait a few seconds until you proceed with the next step.

Create a new CDN Profile & Endpoint

Azure CDN WordPress Configuration Azure Create CDN Profile Endpoint

Navigate to CDN Profiles feature in Azure. Select Create and follow the assistant to configure the CDN profile and endpoint.

Configuration for CDN Profile:
Select the subscription (read more) and a resource group (groups resources; read more). As name of the profile, you can enter your website's/project's/product's name. Region remains on global. And pricing tier can be "Standard Microsoft" for the beginning (read more).

Configuration of CDN endpoint:
Select Create a new CND endpoint to create an endpoint that you can use to serve data stored on CDN servers. As CDN endpoint name, enter an equivilant name to your website, such as lennartwoermer for my website. The URL to serve the data would then be lennartwoermer.azureedge.net. As Origin type, select Custom origin to select a website outside of Microsoft Azure. Then, the Origin hostname is used for your website's URL, such as yourdomain.com, for example lennartwoermer.de.

That's it. Create the CDN profile and endpoint and continue with the next step.

Configure in WordPress

Azure CDN WordPress Configuration Cover image

After the settings in Azure, we now switch to our WordPress website. In the admin dashboard, you can now add the endpoint using a CDN tool of your choice. I recommend WP Rocket and Perfmatters as paid plugins. CDN Enabler from KeyCDN is a free variant that also does its job. Below I show you the configuration settings for all three plugins.

CDN Configuration in WordPress

Let's talk about how to configure an Azure CDN endpoint in WordPress. This is the last step. Remember: It might take a few minutes - depending on the CDN service - until you can see the changes. Please clear cache and visit the website as a visitor (not in admin mode).

WP Rocket

WP Rocket is one of the best - if not the best - plugin for WordPress performance enhancement in the area of caching and file size reduction. The extension also offers the possibility to include CDN services.

  1. Navigate to your WordPress Admin Dashboard
  2. Navigate to Settings > WP Rocket
  3. Select the "CDN" tab
  4. Check the box "Enable Content Delivery Network"
  5. Insert the endpoint that's been configured in Azure CDN (for example: lennartwoermer.azureedge.net)
Azure CDN WordPress Configuration WP Rocket
Configure Azure CDN in WP Rocket

Perfmatters

Perfmatters is the perfect partner for WP Rocket and adds special features to it to optimize WordPress performance. Perfmatters can also be used as a standalone solution, without WP Rocket. The extension offers to include CDN services for further acceleration.

  1. Navigate to your WordPress Admin Dashboard
  2. Navigate to Settings > Perfmatters
  3. Select the "CDN" tab
  4. Activate the "Enable CDN Rewrite" option
  5. Insert the endpoint that's been configured in Azure CDN (for example: https://lennartwoermer.azureedge.net)
Azure CDN WordPress Configuration Perfmatters
Configure Azure CDN in Perfmatters

CDN Enabler by KeyCDN

A free extension for WordPress allows you to enable CDN. CDN Enabler is 100% focused on enabling a Content Delivery Network.

  1. Navigate to your WordPress Admin Dashboard
  2. Navigate to Settings > CDN Enabler
  3. Insert the endpoint that's been configured in Azure CDN (for example: https://lennartwoermer.azureedge.net) in the "CDN Hostname" field
  4. For regular use, no other settings are required (keep them as they are)
Azure CDN WordPress Configuration CDN Enabler
Configure Azure CDN in CDN Enabler (KeyCDN)

Questions & Answers

Can I use Azure CDN with WordPress?

Yes, it works perfectly and it uses the very large Microsoft cloud around the entire world.

Which plugins do I need?

You can use any CDN plugin that allows to rewrite CDN rules. I recommend WP Rocket and Perfmatters as premium plugins. CDN Enabler is a free alternative.

Is Azure CDN faster than other CDN networks?

In my own experience, Azure CDN is an excellent solution. It is built on Microsoft's reliable Azure cloud, which includes numerous locations around the world. Besides Azure CDN, there are other providers like CloudwaysCDN, RocketCDN, StackPath or KeyCDN that I can recommend.

How much does Azure CDN cost?

You can view the Azure CDN prices here. You will be charged per gigabyte. Prices start at around 7 cents per gigabyte. There is no minimum purchase quantityso Azure CDN offers an excellent pricing structure even for small projects.

How can I use Azure CDN with SiteGround?

SiteGround promotes their WordPress plans with CDN integration. A free Cloudflare service is used, which every user can also use outside of SiteGround. To use the full potential of CDN, I recommend the use of a paid CDN (the costs are very low even with Azure CDN, because you pay per gigabyte). The configuration for SiteGround works exactly the same as for other hosting providers. I recommend WP Rocket, Perfmatters or CDN Enabler for setup. Make sure you don't have two CDN services enabled at the same time.

Should use Cloudflare or Azure CDN?

Cloudflare CDN is a well-known service for CDN - especially due to its free service plan, which is limited though. To fully exploit the possibilities of a CDN (especially with regard to performance), I recommend using a paid CDN. Cloudways also offers such a service (CloudwaysCDN). However, there are other CDN services besides Cloudways, such as Azure CDN, which are just as suitable.

Is CloudwaysCDN better than Azure CDN?

Cloudways offers its own Content Delivery Network (CDN) service which is one of the fastest and cheapest ones. With CloudwaysCDN, you pay $1 per 25GB which is even cheaper than Microsoft Azure CDN. If you use Cloudways as your hosting provider (which I can highly recommend), then I'd recommend to also use their CDN network as it's integrated within their system. It's much better than the free plan of Cloudflare and similar to Azure CDN. See this article to learn how to configure CloudwaysCDN.

How can I speed up my WordPress website?

You can speed up your WordPress website by taking various measures. The two most crucial factors are the hosting provider (I recommend Cloudways) and the content, which must be optimized, e.g. through special file formats and sizes of images. A very fast and usually inexpensive addition is the addition of a Content Delivery Network (CDN). Read this article from Cloudways for more great information.

3 responses to "Speedup & Setup WordPress with Azure CDN”

  1. alexbeglov1989 Avatar
    alexbeglov1989

    Another interesting plugin for image optimization: https://wordpress.org/plugins/optipic/ Its automatic convert image to Webp (for webp-supported browsers) and compressed/optimized png/jpeg (for webp-unsupported browsers).

  2. Zak Sef Avatar

    Hey, I enjoyed reading your posts! You have great ideas. Are you looking to get resources about Thai massage or some new insights? If so, check out my website QN7

  3. Hildred Claude Avatar

    Great job site admin! You have made it look so easy talking about that topic, providing your readers some vital information. I would love to see more helpful articles like this, so please keep posting! I also have great posts about Cosmetic Treatment, check out my weblog at 87N

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEnglish