Setting up WordPress on Leaseweb CDN is very easy, as you’ll see. A couple of assumptions before we start:
- WordPress is installed on the origin server
- WP Super Cache or similar is installed within WordPress
- An “Origin” that points to your WordPress installation is already defined within your Leaseweb CDN control panel.
Configuring the zone itself
First thing you want to do is to configure a Pull Zone. Do this by going to “Manage Zones” -> “Pull Zones” and click the “Add” button.
When you click the “Add” button you’ll need to choose one of four “zones”. Since we’ll mainly serve static files (such as images, CSS and JavaScript files) from our WordPress website, choose the “Small files” zone for the best performance.
Now configure your new zone. Start by filling in your CNAME and choose your “Origin” that’s already been created.
This will generate a “Target”. This is what we’re going to use for WordPress to serve static files on. You can also add the CNAME itself to your DNS, pointing to the target generated.
Under “Advanced settings” you can add additional CNAMES. This might be beneficial if you want to increase the concurrent connections your site may use to download static resources. In general between one and three domains is recommended but test it for your specific site because it might differ a bit. Next, go to “Edge settings” and activate “Ignore Cookies” as well as “Cache query string” as below:
Scroll down and click the “Save” button. Then wait 1-2 minutes for the zone to become fully active on the CDN.
Configure WordPress to make use of Leaseweb CDN
The next step is to actually tell WordPress to make use of the CDN to serve static files.
You can proceed with either installing a plugin called WP Super Cache, W3 Total Cache or CDN linker.
In this post we’ll use WP Super Cache as an example. You go into WP Super Cache, which can be found under “Settings” -> “WP Super Cache”. Set Caching to “On”:
After this you go to the “CDN”-section within WP Super Cache, and check the checkbox “Enable CDN Support” as well as putting the CDN url http://.lswcdn.net in the “Off-site URL” input field you see, and then scroll down and click “Save”.
The final step is to go to the frontend of your WordPress website and check the page source. You’ll see images, CSS and Javascript are loaded from the Leaseweb CDN.
Congratulations! Now you’re in business.