How to Create a CDN with cPanel and Bunny.net

A content delivery network, or CDN, stores cached copies of your files on servers around the world. Visitors can then download images, CSS, JavaScript, videos, and other static files from a location closer to them.

This guide explains how to create a CDN using a cPanel hosting account and Bunny.net. We will use the Web Host Pro CDN as a real example:

  • Origin URL: https://origin.webhostpro.com
  • Public CDN URL: https://cdn.webhostpro.com

Your origin URL stores the original files. Your public CDN URL delivers cached copies of those files through Bunny.net.

Web Host Pro customers: We can help create and configure your Bunny.net CDN at no additional charge. Contact support after creating your Bunny.net account.

Before You Begin

You will need:

  • A domain hosted on a cPanel account
  • Access to cPanel
  • Control over the domain's DNS records
  • A Bunny.net account

Create your Bunny.net account here

Step 1: Choose Your CDN Subdomains

We recommend using two subdomains:

  • origin.yourdomain.com stores the original files on your cPanel account.
  • cdn.yourdomain.com is the public address connected to Bunny.net.

Our working example uses:

  • origin.webhostpro.com
  • cdn.webhostpro.com

Do not use the CDN hostname as the Bunny origin. Bunny must retrieve files from the separate origin hostname.

Step 2: Create the Origin Subdomain in cPanel

  1. Log in to cPanel.
  2. Open Domains.
  3. Click Create a New Domain.
  4. Enter your origin subdomain, such as origin.yourdomain.com.
  5. Choose a document root for the CDN files.
  6. Click Submit.

A typical document root would be:

/public_html/origin

For the Web Host Pro example, files available inside the origin document root can be accessed through:

https://origin.webhostpro.com/filename.jpg

Step 3: Upload a Test File

  1. Open File Manager in cPanel.
  2. Open the origin subdomain's document root.
  3. Upload a small image or text file.
  4. Open the file directly through the origin URL.

For example:

https://origin.webhostpro.com/test-image.jpg

Do not continue until the file loads successfully over HTTPS. Bunny.net cannot retrieve a file that is missing, blocked, or inaccessible from the origin URL.

Step 4: Create a Pull Zone in Bunny.net

  1. Log in to your Bunny.net account.
  2. Click Add Pull Zone.
  3. Enter a name for the Pull Zone.
  4. Enter your origin URL.
  5. Select your preferred pricing zone or network options.
  6. Click Add Pull Zone.

For the Web Host Pro example, the origin URL is:

https://origin.webhostpro.com

Bunny will also create a temporary hostname similar to:

yourzonename.b-cdn.net

Save this hostname. You will use it when creating the CDN DNS record.

Step 5: Test the Bunny Pull Zone

Before adding your custom CDN hostname, test the Bunny hostname with the file you uploaded.

For example:

https://yourzonename.b-cdn.net/test-image.jpg

Bunny should retrieve the file from your origin server and deliver it through its CDN.

If the file does not load, check:

  • The origin URL is entered correctly.
  • The file loads directly from the origin hostname.
  • The filename and capitalization match exactly.
  • The origin server is not blocking Bunny.net.
  • The origin has a working SSL certificate.

Step 6: Add Your Custom CDN Hostname

  1. Open your Pull Zone in Bunny.net.
  2. Open General.
  3. Find the Hostnames section.
  4. Add your public CDN hostname, such as cdn.yourdomain.com.

Our example hostname is:

cdn.webhostpro.com

Step 7: Create the CDN CNAME Record in cPanel

  1. Log in to cPanel.
  2. Open Zone Editor.
  3. Find your domain and click Manage.
  4. Click Add Record.
  5. Select CNAME as the record type.
  6. Enter your CDN hostname in the Name field.
  7. Enter the Bunny Pull Zone hostname in the CNAME or Record field.
  8. Save the record.

The record should look similar to this:

Type Name Points To
CNAME cdn.yourdomain.com yourzonename.b-cdn.net

For our Web Host Pro setup:

cdn.webhostpro.com → Web Host Pro's Bunny Pull Zone hostname
Important: Remove any existing A, AAAA, or CNAME record using the same cdn hostname before adding the new CNAME record. A hostname cannot use conflicting DNS records.

Step 8: Enable SSL in Bunny.net

DNS changes can take several minutes to begin working. Once Bunny confirms that the CNAME record is correct:

  1. Return to your Pull Zone.
  2. Open General and find Hostnames.
  3. Locate your custom CDN hostname.
  4. Enable the free SSL certificate.
  5. Enable Force SSL so requests always use HTTPS.

Your files should now load through your custom CDN URL:

https://cdn.yourdomain.com/test-image.jpg

Our example would be:

https://cdn.webhostpro.com/test-image.jpg

Step 9: Start Using the CDN

Replace the origin URL with the CDN URL when linking to files on your website.

Original file URL:

https://origin.webhostpro.com/images/example.jpg

Public CDN URL:

https://cdn.webhostpro.com/images/example.jpg

Example HTML image:

<img src="https://cdn.webhostpro.com/images/example.jpg" alt="Example image">

Example stylesheet:

<link rel="stylesheet" href="https://cdn.webhostpro.com/css/style.css">

Example JavaScript file:

<script src="https://cdn.webhostpro.com/js/app.js"></script>

Step 10: Configure Caching

Bunny.net provides default caching settings that work for many static files. You can adjust these settings inside the Pull Zone under Caching.

Files commonly delivered through a CDN include:

  • Images
  • CSS stylesheets
  • JavaScript files
  • Fonts
  • Videos
  • Software downloads
  • PDF documents

Avoid aggressively caching pages or files that contain customer-specific, account-specific, or frequently changing information unless you understand the cache rules being used.

Updating Files and Clearing the Cache

Updating a file on the origin server does not always remove the older cached copy immediately.

After replacing a file, you can:

  1. Open the Pull Zone in Bunny.net.
  2. Open the cache management or purge section.
  3. Purge the individual file URL or clear the Pull Zone cache.

Purging only the changed file is normally better than clearing the entire CDN cache.

Common Problems

The CDN URL Shows an SSL Error

Confirm that the CDN hostname has a CNAME record pointing to the Bunny Pull Zone hostname. Bunny cannot activate its certificate until the hostname resolves correctly.

The CDN URL Returns a 404 Error

Open the same path using the origin URL. If the file does not exist at the origin, Bunny cannot retrieve it.

The CDN Shows an Older Version of a File

Purge that file from the Bunny cache or rename the file when uploading the updated version.

The CNAME Record Cannot Be Added

Delete any existing A, AAAA, or CNAME record using the same CDN hostname, then create the Bunny CNAME record again.

The Origin Is Behind Cloudflare

Bunny should be able to connect directly to the origin server. Security rules, bot protection, rate limits, or another proxy service can sometimes block Bunny from retrieving files.

When using Cloudflare DNS for the CDN hostname, keep the Bunny CNAME record set to DNS only while validating and issuing the SSL certificate.

Final Setup Checklist

  • The origin subdomain loads over HTTPS.
  • The test file loads directly from the origin.
  • The Bunny Pull Zone uses the correct origin URL.
  • The test file loads through the Bunny hostname.
  • The custom CDN hostname has been added to Bunny.
  • The CDN hostname points to Bunny with a CNAME record.
  • Free SSL and Force SSL are enabled.
  • The test file loads through the custom CDN URL.

Free CDN Setup Help for Web Host Pro Customers

Web Host Pro customers can contact our support team for free help setting up a Bunny.net CDN with their cPanel hosting account.

We can help with:

  • Creating the origin subdomain
  • Creating the Bunny.net Pull Zone
  • Connecting the custom CDN hostname
  • Adding the correct DNS record
  • Activating SSL
  • Testing the CDN
  • Troubleshooting common origin and caching problems

Create a Bunny.net account and then contact Web Host Pro support with the domain and CDN hostname you would like to use.

Was this answer helpful? 126 Users Found This Useful (128 Votes)