The Content Delivery Network, aka CDN, is the cluster network that serves the static files from the closest data center to the end user. WordPress has its CDN network known as Photon CDN which syncs and serves the images from the WordPress blog.
However, officially WordPress Photon CDN needs a Jetpack Plugin to support free CDN. But, most WordPress bloggers and developers do not prefer installing Jetpack as it’s too heavy. Hence, many WordPress users miss the chance to use this free CDN service.
ALERT: It is not recommended to misuse the Photon CDN. If you’re a business owner or host multiple websites, use the Jetpack module or switch to any other paid service. I’ve personally switched to Cloudflare CDN and it works great.
In this article, we will learn how to set up the CDN Enabler plugin to use the WordPress Photon CDN address for serving the images via free CDN without installing the Jetpack module.
Let’s dive into setting up the free WordPress Photon CDN for media images without the Jetpack plugin —
What is WordPress Photon CDN?
WordPress Photon CDN is the free image content delivery network that serves the locally uploaded images from the nearest data center server spread across the globe.
Suppose my server is hosted at the New York data center, and a blog reader is accessing the files from Sydney. This is long distance for static files to travel; hence the website load time will increase significantly.
But, when we use a CDN service like WordPress Photon CDN for images. The static image files are synced across all WordPress data centers. Now when the same reader access the files from Sydney, WordPress tries to access the static image from the nearest data center instead of our server location, i.e., New York.
Hence, improving the site load speed and thus the user experience.
Install CDN Enabler WordPress Plugin
We are going to use this plugin called CDN Enabler by KeyCDN. This plugin helps to alter our website address and replace it with the WordPress photon’s address.
Follow the steps to install CDN Enabler on WordPress:
- Login to your WordPress Dashboard
- Navigate to Add New option under the Plugins menu
- Search and Install for CDN Enabler by KeyCDN
- Activate the plugin and head over to the CDN Enabler settings page
Setup CDN Enabler plugin for Photon CDN
The Photon CDN has 4 different CDN address that helps to serve the images from WordPress CDN. The Photon CDN addresses are:
These addresses are dynamically changed when we use the Jetpack-enabled Photon CDN. However, we will use either address in our case since CDN Enabler has only one field.
Let’s use the first address i.e. i0.wp.com for our demo site. Setup the CDN Enabler with the details below and ensure you’ve correctly entered your image library location.
- CDN URL: Enter the CDN address and your domain name to serve the images. The CDN URL for my demo.restorebin.com will be: https://i0.wp.com/demo.restorebin.com
- Included Directories: These are the default image library directory in our WordPress installation. You can leave it to default whatever this is displayed in the field. You may also add multiple local directories by separating them with ,
- Exclusions: List of file types that need to excluded from the CDN Enabler to apply the CDN URL. Make sure that you’ve excluded all the file types except image filetype. I personally exclude the following types: .php, .js, .json, .mp4, .pdf, .apk, .css
- Relative Path: Keep this option enabled
- CDN HTTPS: Enable this option to serve the images from HTTPS instead of HTTP. Since we have already set up the Let’s Encrypt SSL certificate, it’s essential from a security standpoint that we are serving the images from HTTPS
- KeyCDN API Key and KeyCDN Zone ID shout be blank
Upload and Test Free Image CDN
Now let’s upload an image into our media library to see if the images are served from the Photon CDN address; since we have set up to use the i0.wp.com CDN address for all the images, it should serve our uploaded image from the same address.
Video on Photon CDN without Jetpack
Watch the video tutorial on setting up the WordPress Photon CDN for serving the images from wp.com without using the Jetpack plugin.
I hope you liked the video; please subscribe to our channel.
What’s Next in the #WordPressBlog Series?
Now that we have set up the free CDN for WordPress images using CDN Enabler, we will check in on setting up the free CDN for our CSS styles and JS script files.