Back to technical articles index.
A Content Delivery Network (CDN) is a system using advanced software for organizing, storing, and streaming website content for the purpose of optimizing the flow of content to users. It distributes the content to multiple, geographically diverse nodes and then serves the content from the node that is closest to the user, minimizing packet travel and increasing speed and efficiency.
A CDN delivers content more efficiently than standard Internet content delivery, letting businesses meet the growing demand for rich, online media that require large bandwidths. Any company or individual that wants to make content available on the Internet needs to consider a CDN.
This article shows you how to use a SoftLayer® CDN to accelerate your WordPress blog in the IBM® Cloud.
The following services of the IBM Cloud marketplace are used in this article:
The following diagram illustrates the solution that was created with this example. A WordPress, which is deployed in the IBM Cloud, uses a SoftLayer CDN to deliver its static content.
There are two types of stakeholders: users viewing the content and the SoftLayer customers who run the WordPress site. In this article, we use “user” for the first type and “customer” for the second type.
Step by step
Step 0: Prepare your environment
- If you don’t have a SoftLayer account already, obtain a SoftLayer account.
- Ensure that you have permissions to manage the CDN account and CDN File Transfers for your SoftLayer account.
- If you don’t have an IBM ID already, obtain an IBM ID and register for the IBM Cloud marketplace.
Step 1: Set up your WordPress in the IBM Cloud
Follow the steps in Hosting your WordPress blog in the IBM Cloud to deploy a WordPress blog in the IBM Cloud.
Step 2: Order the SoftLayer CDN
There are two ways that a SoftLayer CDN can distribute your content:
- Origin Pull: Store your content on a SoftLayer server or computing instance, or on another location on the Internet. The content’s location is registered with the CDN. When the first user requests the content, it’s pulled to the network and delivered from the closest point to that user. The content does not have to be manually uploaded to the CDN. The content then remains on the network for other users to access it. Using Origin Pull requires a bandwidth plan, but no storage charges are incurred.
- POP Pull: Customers can preload content through the EdgeCast API, SoftLayer API, SoftLayer Portal, or the customer’s own portal. That content is pulled from the CDN FTP server as opposed to being pulled from the customer’s original location. Pay As You Go or monthly pricing is based on the bandwidth and storage used, and mix and match rate plans are available.
Typically, sites with heavy traffic loads will benefit from an Origin Pull CDN, because the content is pulled from the host server and users can pull the cache content from the CDN. Alternatively, customers can benefit from a POP Pull CDN by controlling the content that gets uploaded to a CDN FTP site when it expires. Regardless of the type of CDN chosen, deploying a CDN means getting content to users faster and more efficiently. For WordPress in this article, we’ll use an Origin Pull CDN.
Log in to the SoftLayer customer portal and add a CDN service by navigating to Sales -> Add CDN Service. There is no configuration at this point, so just place the order.
Step 3: Get your CDN account name
After the order is processed, the new CDN account is displayed in the SoftLayer customer portal (Public Network -> Content Delivery Network). Remember the account name of the newly created CDN account, because it will be used in the next step. In this example, the account name is
Step 4: Update your DNS zone
In addition to your WordPress site domain, you also need a custom domain for your CDN content. In this example, we use
blog.playvm.com for our WordPress site domain, and we use
cdn.playvm.com for our CDN domain. Our demo domain name is
playvm.com, which is registered in GoDaddy. Your CDN domain must be set as a CNAME record that points to your SoftLayer CDN account domain. The SoftLayer CDN account domain is your CDN account name with the suffix of
.http.cdn.softlayer.net. In this example, our SoftLayer CDN account domain is
Add the CDN CNAME record to your domain DNS zone in your domain DNS provider. In this example, we use GoDaddy as the domain provider. We see that the host
blog is mapped to the IP address
18.104.22.168 and that the
cdn hostname is mapped to the account domain assigned for our SoftLayer CDN,
Step 5: Add Origin Pull mapping in your SoftLayer CDN account
After the update of your DNS zone, you can add the Origin Pull mapping in your SoftLayer CDN account. Click More to the right of your CDN account and select Origin Pull from the pop-up menu.
Select HTTP url for the Media Type, enter your WordPress site domain (
blog.playvm.com in this example) in the Origin Domain field, enter your CDN domain (
cdn.playvm.com in this example) in the CNAME Record field, and save the changes.
Step 6: Install the WordPress CDN plug-in
To distribute your WordPress static content by using the SoftLayer CDN, you need to rewrite all URIs referencing static content to point to your SoftLayer CDN domain, and you need to configure the WordPress cache policy to use the CDN. It’s not an easy job; fortunately, there are several WordPress plug-ins that can help you. In this example, we use the WP Super Cache plug-in to enable the SoftLayer CDN for your WordPress.
You can install the WP Super Cache plug-in from the WordPress admin panel:
- Navigate to Plugins -> Add New.
- Search for
WP Super Cache.
- Find the WP Super Cache plug-in in the search results, and click Install Now to install the plug-in.
- After the plug-in is installed, click Activate Plugin to activate the WP Super Cache plug-in.
Step 7: Configure the WordPress CDN plug-in
Navigate to Settings -> WP Super Cache.
On the Easy tab, select Caching On for the Caching option and click Update Status.
On the CDN tab, select Enable CDN Support, type
http://cdn.playvm.com in the Off-site URL field, and select Skip https URLs to avoid “mixed content” errors. Keep the other configuration defaults and save the changes.
Step 8: Check the results
You have completed the SoftLayer CDN support for your WordPress. Open your WordPress site in a Firefox browser. Now, the static contents of your WordPress site are from the SoftLayer CDN. In the following figure, Firebug was opened in the lower part of the panel. It shows the GET requests from WordPress for a page with static content that is pulled from
cdn.playvm.com. HTTP response code 304 means that the requested content has not changed from your last request.
References and further reading
- For technical information about the IBM Cloud, see the SoftLayer Knowledge Base.
- To get started with the IBM Cloud marketplace, see https://developer.ibm.com/marketplace/docs/getting-started-2/.
- For more information about the SoftLayer CDN, see http://www.softlayer.com/content-delivery-network and the CDN topic on SoftLayer KnowledgeLayer.
- For more information about GoDaddy, see http://www.godaddy.com/.
- For more information about WP Super Cache, see https://wordpress.org/plugins/wp-super-cache/.