How To Maximize Your WordPress Website Performance with Cloudflare CDN Print

  • Website Performance, WP Squared, Security Enhancement, CDN Integration, WordPress Optimization, API Key Management, Cloudflare
  • 0

Learn how to turbocharge your WP Squared WordPress website's performance by seamlessly integrating Cloudflare as a Content Delivery Network (CDN) service. Improve site speed, enhance security, and boost SEO rankings with this step-by-step tutorial suitable for beginner, intermediate, and advanced users.

In today's fast-paced world, website speed is crucial. A slow website frustrates visitors and hurts your search engine ranking. A Content Delivery Network (CDN) can significantly improve website performance by delivering content from geographically distributed servers. This tutorial will guide you on setting up Cloudflare as a CDN for your WebHostingM WP Squared website.

Why Use a CDN?

Imagine your website as a store. A CDN acts like multiple warehouses strategically located around the globe. When a customer visits your store (website), they get served products (content) from the nearest warehouse (server), resulting in a faster experience. Here's how a CDN benefits your website:

  • Blazing-Fast Loading Speeds: Deliver content from servers closest to your visitors, dramatically reducing load times.
  • Enhanced User Experience: Faster loading times keep visitors happy and engaged.
  • Improved SEO: Search engines favor websites that load quickly.
  • Reduced Server Load: The CDN handles a significant portion of traffic, taking pressure off your web server.
  • Increased Reliability: CDNs offer redundancy, ensuring your website remains accessible even during traffic spikes or outages.

WP Squared by default offers a simple click-to-play Content Delivery Network (CDN) feature, but to truly optimize your website's performance, integrating a robust CDN service like Cloudflare is essential.

 

Step-by-Step Guide: Configuring Cloudflare CDN in WP Squared

1. Sign Up for a Free Cloudflare Account (if you haven't already)

Head over to https://www.cloudflare.com/ and create a free account. This basic plan offers excellent features for getting started.

2. Create a Cloudflare API Key

Cloudflare's Global API key is the previous authorization scheme for interacting with the Cloudflare API. The Global API key though has multiple limitations when compared to API tokens:

  • Access to all Cloudflare resources: The global API key has access to all of a user's resources. This makes it impossible to safely use the Global API key to access non-production resources when a user also has access to production resources.

  • Full permissions: Similarly, the Global API key has the same permissions as the user, which means if the user can delete zones or change DNS records, so can the Global API key.

  • Limited to one per user: Only one Global API key can be provisioned per user. This complicates using Cloudflare’s API in production systems where maintaining two secrets for accessing the API is important in the case one needs to be rolled.

  • Lack of advanced limits on usage: API tokens can be limited to specific time windows and expire or be limited to use from specific IP ranges.

While the Global API key is not recommended by Cloudflare for new customers, it is easier to start with. As you get more comfortable, you might want to migrate and use API tokens instead.

 

Global API Key (Legacy Option)

Note that WP Squared does not store your Global API Key. The Global API Key is used to generate a token on your behalf to synchronize DNS records.

 

API Token (Recommended)

At the moment, the WP Squared dev team does not recommend using an API Key Token.

Cloudflare though recommends that you use this. So if you can, choose this route. If you have an issue with it, contact Cloudflare support or use the Global API Key option.

Understanding Permissions: A Table for Easy Reference

As we proceed, you'll encounter permission levels for your Cloudflare API key which is needed for this to work properly.

This table summarizes them:

Group

Resource

Permission

Description

 Zone

 Analytics  Read  Allows viewing website traffic statistics.

 Zone

 Zone  Edit  Grants full control over zone settings, including DNS records.

 Zone

 Zone Settings  Edit  Allows modifying zone-level configurations.

 Zone

 DNS  Edit  Enables adding, editing, and deleting DNS records.

 Zone

 Cache Purge  Purge  Lets you purge cached content on the CDN for specific URLs.

 Zone

 Cache Rules  Edit (Optional)  Provides control over how content is cached by the CDN.

In your Cloudflare dashboard, go to My Profile > API Tokens.

Select Create Token.

When the page loads, you have two options: you can either use the Edit zone DNS template or the Create Custom Token option.

You can also opt to use a template from Cloudflare's available API token templates.

Templates are prefilled with a token name and permissions.

Add or edit the token name to describe why or how the token is used.

Modify the token's permissions by selecting a permissions group (Account, User, or Zone), and choose what level of access to grant the token.

Most groups offer Edit or Read options. Edit is full CRUDL (create, read, update, delete, list) access, while Read is the read permission and list where appropriate.

Select which resources the token is authorized to access.

This is useful if you have several zones in your Cloudflare account.

For example, you can choose to grant to a zone "example-domain.com", this will allow the token to read DNS records only for that specific zone.

Any other zone will return an error for DNS record "reads" operations. Any other operation on that zone will also return an error.

(Optional) Restrict how a token is used in the Client IP Address Filtering and TTL (Time To Live) fields.

You may want to use the TTL option if you give a developer access to your WordPress instance.

It is also a good practice to occasionally rotate production tokens but that will require adding that to your calendar so that you don't forget.

This screenshot is what our example configuration looks like:

How To Create API Token in Cloudflare

 

Select Continue to summary and you will see a page that looks like the screenshot image below.

How To Get Cloudflare API Token Step 2

Review the token summary and if something looks wrong, select Edit token to make adjustments. You can also edit a token after creation.

Select Create Token to generate the token's secret.

Please note that the token secret is only shown once. You won't be able to retrieve it later.

We also suggest that you treat any credential as anyone with this token can perform the authorized actions against the resources that the token has access to.

So do not store the secret in plaintext where others can access it.

You can also use the /user/tokens/verify endpoint to fetch the current status of the given token via the command line:

curl "https://api.cloudflare.com/client/v4/user/tokens/verify" \ -H "Authorization: Bearer $API_TOKEN"

 

Configure WP Squared CDN Settings

  • Log in to your WebHostingM WordPress dashboard at https://wptools.wp2panel.com:2083/ and navigate to your WP Squared website management panel.
  • Access the Extended Website View.
  • In the Tools section, locate the Enable a CDN switch and toggle it on.
  • From the dropdown menu, select Cloudflare (currently the only supported provider).
  • Enter your Cloudflare email address associated with your account.
  • Paste your Global API Key or API Token Secret (depending on your chosen method) into the designated field.
  • Provide a brief description of the API key/token for future reference.
  • Click Submit to save the configuration.

 

Verify and Test Your CDN Setup

After saving the configuration in WP Squared, it may take some time for Cloudflare to propagate the changes. You can monitor the status in your Cloudflare dashboard under the specific zone you connected.

Testing Your CDN

Testing the CDN integration after implementation is crucial to ensure it's working correctly and delivering the desired improvements in website performance.

There are several ways to test if your CDN is working correctly:

  • Page Load Speed: Use online tools like GTmetrix: https://gtmetrix.com/ or Pingdom: https://tools.pingdom.com/ or Google PageSpeed Insights to measure the page load speed before and after CDN integration. Look for significant improvements in loading times, especially for images, scripts, and stylesheets.

  • Content Caching: Clear your browser cache and reload your website. Check if static content like images, CSS files, and JavaScript files are served from the CDN cache. You can use browser developer tools to analyze network requests and headers. If you have installed the WP Accelerate plugin to the WordPress website, pay special attention to this part as the plugin may already have these features enabled if configured correctly.

  • Content Distribution: Use tools like CDN Finder or CDN Planet to verify the geographical distribution of CDN servers. Test your website's loading speed from different locations around the world to ensure efficient content delivery.

  • VPN Testing: Use a VPN service to simulate access from different regions. Test your website's performance and loading times to confirm that the CDN effectively serves content to users worldwide.

  • Firewall Rules: Check if Cloudflare's security features, such as DDoS protection and Web Application Firewall (WAF), are active and blocking malicious traffic effectively. Perform security tests to ensure that your website is protected against common threats. This may not be needed as our security suites offer this by default.

  • SSL Certificate: Verify that SSL/TLS encryption is enabled and working correctly for secure HTTPS connections. Check for any mixed content warnings or certificate errors.

  • Content Integrity: Ensure that all website content, including images, scripts, and stylesheets, is loading correctly without any errors or missing elements. Validate the integrity of cached content served by the CDN.

  • Dynamic Content: Test the delivery of dynamic content, such as user-generated data or personalized pages, to ensure that it's properly cached and served by the CDN without any issues.

  • CDN Analytics: Utilize Cloudflare's analytics dashboard or third-party monitoring tools to track CDN performance metrics, including bandwidth usage, cache hit ratio, and request latency. Monitor these metrics regularly for insights into CDN performance and optimization opportunities.

  • Real-Time Monitoring: Use our 360 Monitoring to set up alerts and notifications for critical events, such as CDN downtime or performance degradation. These real-time monitoring tools will help you to detect and troubleshoot issues promptly.

 

WebHostingM Support

If you encounter any difficulties during this process, please reach out to our support team by submitting a ticket at https://mydashboard.webhostingm.com/submitticket.php.

By configuring Cloudflare as a CDN for your WebHostingM WordPress website, you've taken a significant step towards enhancing website speed, user experience, and SEO. Remember, a fast website is a happy website, and happy websites lead to success.


Did this answer help?

« Back

Trusted by over 35,000 customers in over 200 countries