Menu

BunnyCDN Deployment Add-On

Auto-deploy your generated static site to BunnyCDN.

Configuration

via UI

Input your BunnyCDN connection settings via the WP2Static > BunnyCDN menu.

via WP-CLI

wp wp2static bunnycdn options set name value

Available optionExample input
bunnycdnAccountAPIKey9cff0fd9-7b86-4dad-be05-dabf5959e
bunnycdnStorageZoneNamemystoragezonename

How it works

The BunnyCDN deployment add-on deploys your static site files to a BunnyCDN StorageZone and purges cache from the connected Pull Zone. The BunnyCDN Storage API is used to transfer files, currently limited via the API to 1 file at a time. WP2Static’s internal deploy cache is used to only transfer files changed between deploys.

A BunnyCDN Storage Zone allows files to be stored on BunnyCDN’s servers vs pulling from an origin server. A BunnyCDN Pull Zone sits in front of this Storage Zone, allowing static site hosting to work by routing requests to your custom domain to be served by files in the Storage Zone.

BunnyCDN takes care of distributing your static site across all it’s geographic regions for fastest load speeds to all your site’s visitors.

You can further optimize your site’s delivery using the Pull Zone settings available via BunnyCDN’s web UI, such as cache expiration times, number of datacentres, disabling cookies, image optimization, CSS/JS minification and more. Some of these options incur additional costs.

As we need the Account API Key to purge cache, we reduce the amount of options required for this add-on and use the API to find the Storage Zone Access Key when making requests to the Storage Zone API. Similarily, we detect the Storage Zone’s connected Pull Zone ID from the API. This just adds an extra API call behind the scenes vs requiring the user to input additional fields, like in the V6 BunnyCDN deployment option.

Configuration within WP2Static

There are only a few options you need to set in the plugin.

In WP2Static’s core “Options” menu (or via WP-CLI), set the Destination URL value to the final URL you plan to host your site on (ie, https://example.com.

In WP2Static’s BunnyCDN options, you’ll set the following:

Configuration within BunnyCDN

Requirements for using this add-on with BunnyCDN:

Step by step setup for a new BunnyCDN site

Get BunnyCDN Account API Key

Create Storage Zone

Connect Pull Zone

Name Pull Zone

Connect Custom Domain

Add your Destination URL in WP2Static

Successful Deploy

Successful Logs

Managing your Storage Zone

To help me develop this add-on and troubleshoot when things go wrong, I’ve added the following WP-CLI commands to the BunnyCDN add-on:

Troubleshooting

# lists contents of Storage Zone
curl --include \
     --header "Accept: application/json" \
     --header "AccessKey: STORAGE_ZONE_API_KEY" \
  'https://storage.bunnycdn.com/STORAGE_ZONE_NAME/'

Notes

BunnyCDN is a great CDN option, having a small, responsive and friendly team in Slovenia and offering edge locations where other providers don’t. Their web UI is quite easy to use. The Storage Zone API is unfortunately a bit lacking in ability to bulk upload files.

Site menu

Back to top