How to Point a Domain to BunnyCDN and Deploy It Using Stacking.Cloud
BunnyCDN is a powerful and affordable content delivery network that can help you serve your website efficiently.
This tutorial will guide you through setting up your domain on BunnyCDN, configuring DNS settings, adding a custom hostname, enabling SSL, and setting up edge rules for optimal redirection.
Step 1: Update Your Domain’s Nameservers
First, you need to point your domain to BunnyCDN by updating your nameservers in your domain registrar (e.g., NameSilo or Namecheap).
Steps to update nameservers:
- Log in to your domain registrar’s dashboard.
- Locate your domain and access the DNS or Nameserver settings.
- Replace the existing nameservers with BunnyCDN’s nameservers (see the example):
coco.bunny.net
kiki.bunny.net
- Save the changes.
Note: It may take a few minutes to a few hours for DNS changes to propagate. You can check the DNS propagation at https://dnschecker.org/
Step 2: Add Your Domain to BunnyCDN’s DNS Zone
Now, you need to set up the DNS records in BunnyCDN.
Steps to configure DNS:
- Log in to your BunnyCDN dashboard.
- In the sidebar, click on DNS.
- Click Add DNS Zone and enter your domain name (e.g.,
yourdomain.com
). - Add the necessary CNAME records:
- Type: CNAME
Host:@
(or leave blank for the root domain)
Value:yourbunnycustomcdn
.b-cdn.net
- Type: CNAME
Host:www
Value:yourbunnycustomcdn
.b-cdn.net
- Type: CNAME
- Save the DNS records.
Step 3: Configure BunnyCDN Delivery Settings
Once the DNS is set up, you need to configure the content delivery settings.
Steps to set up the Pull Zone:
- In the BunnyCDN dashboard, go to CDN from the sidebar.
- Locate your Pull Zone (e.g.,
yourbunnycustomcdn.b-cdn.net
). - Click Add Custom Hostname.
- Add both:
yourdomain.com
www.yourdomain.com
- Enable Force SSL to ensure secure connections.
- Click Save.
Note: SSL certificates might take a few minutes to activate.
Step 4: Create Edge Rules for URL Redirection
To ensure proper URL redirection (e.g., forcing HTTPS and redirecting www
to the root domain), you need to create an Edge Rule.
Steps to create an Edge Rule:
- In the BunnyCDN dashboard, navigate to Edge Rules.
- Click Create New Rule.
- Configure the following settings:
- Actions:
- Select Redirect to URL.
- Value:
https://yourdomain.com%{Url.Path}%{Request.QueryString?}
%{Url.Path}%{Request.QueryString?}
- Conditions:
- Select Request Header.
- Header Name:
host
- Value:
www.yourdomain.com
- Actions:
- Save the rule.
Step 5: Test Your Setup
After completing the setup, verify everything is working correctly.
- Open your browser and navigate to:
https://yourdomain.com
https://www.yourdomain.com
- Ensure the SSL certificate is active (check for the padlock icon in the address bar).
- Confirm that requests to
www.yourdomain.com
correctly redirect toyourdomain.com
.
Conclusion
If you encounter any issues, clear your browser cache and DNS cache, or use DNS Propagation Checker to verify changes.