When it comes to hosting, there will always be limitations, even if they aren’t advertised. There is no such thing as unlimited disk space or unlimited bandwidth. Certain hosts might market it this way, but then end up either suspending your account or charging overage fees. We don’t like this approach and make our plan limitations very clear here at Kinsta. Today we want to show you how to optimally offload PDF, DOCX, and MP3 hosting so that you don’t have to worry about it impacting your primary WordPress host. It can also help save you a significant amount of money by decreasing bandwidth and disk space.
Offloading Storage of PDF, DOCX, and MP3s
The first issue many sites with a large amount of PDF, DOCX, or MP3 files have is that they consume a lot of disk space. MP3 files can’t always be compressed to smaller file sizes like when optimizing images. This can quickly consume your entire hosting plan and end up forcing you to upgrade. A typical MP3 file can be around 3 MB in size. While this might not sound like a lot, let’s say you have 1,000 MP3 files on your site. That right there alone is 3 GB. There are a lot of different ways to approach this, but we’ll share with you one that works great for our clients here at Kinsta.
Kinsta Disk Space Add-On
If you’re a Kinsta user who prefers a convenient solution that doesn’t require setting up an external provider, we offer a disk space add-on in the MyKinsta dashboard. Additional disk space can be purchased in 20 GB increments at $1/GB. Best of all, the disk space add-on is 100% compatible with Kinsta CDN and our dashboard analytics.
Important: if you’re a Kinsta user, all types of video files (avi, mp4, mpeg, mpg, webm, mov, etc.) must be hosted externally. Services like YouTube/Vimeo are often suggested but they’re not your only option. If you prefer to offload media to an external provider, feel free to check out our Amazon S3 and Google Cloud Storage integration guides below!
Offload Storage to Amazon S3
You first need to offload the storage somewhere else so it isn’t consuming your origin server’s (WordPress host) disk space. One of the easiest ways to do this is to integrate with a service like Amazon S3. It is very similar to a web host, but generally, offers less expensive bandwidth and storage. Typically this is used for large sites that either need additional backups or are serving up large files (downloads, software, videos, games). Amazon has a proven track record of being very reliable, and because of their massive infrastructure, they are able to offer very low storage costs. Some of S3’s customers include Netflix, Airbnb, SmugMug, Nasdaq, etc.
Check out our in-depth integration guide for WordPress and Amazon S3. You can enable the option to remove the files from the local server once they have been offloaded to S3. This can help drastically reduce the disk space need with your WordPress host.
Offload Storage to Google Cloud Storage
You could also use this same approach with WordPress and Google Cloud Storage. Serve media files directly from Google Cloud Storage, use it as a secondary backup, or even hook it up with a CDN. Remove the locally stored files automatically to save disk space.
Caching Delivery of PDF, DOCX, and MP3s on CDN
Another scenario you perhaps have is that you have enough disk space with your hosting provider, but your problem is simply high bandwidth consumption. In this case, you can offload and cache the delivery of your PDF, DOCX, and MP3 files with a content delivery network (CDN). Read our in-depth post on why you should be using a WordPress CDN. You could also combine the following approach with the offloading storage option mentioned above.
WordPress hosts such as Kinsta also cache your content, but between updating your site and clearing the cache for development or testing purposes, caching on a CDN is usually more robust. Assets cached on a CDN are not meant to be purged frequently, that is how they can deliver your content faster. Caching on a CDN can help prevent traffic spikes from overwhelming your host and decrease your bandwidth costs. The last thing you want is for something to go viral and you’re left with a whopping bill.
We have seen that CDNs on average can offload up to 70% of the traffic.
How to Cache PDF, DOCX, and MP3s with Cloudflare
Cloudflare is a popular CDN provider with WordPress users, primarily because of its free plan and large network. If you’re a Kinsta customer, you can leverage Cloudflare’s CDN without having to set up your own Cloudflare account or set up any custom rules. All you need to do is enable Kinsta CDN in MyKinsta at no additional cost. After enabling Kinsta CDN, if you see any issues with caching of PDF or DOCX files on your site, our Support team is available 24/7 and happy to help.
If you’re not a Kinsta customer and want to set up your own Cloudflare account, here are a few useful tutorials to get you started:
- How to Install Cloudflare
- How to Configure Amazon S3 With Cloudflare
- How to Set up Cloudflare APO for WordPress
By default, Cloudflare caches PDF and DOCX files. However, to cache MP3 files you have to configure page rules on your WordPress site.
Create Cloudflare Page Rule
To create a page rule log in to Cloudflare and click on “Page Rules.” Then click on “Create Page Rule.”
Page rules allow you to create dynamic patterns to match URL requests on your traffic. Below is an example of the syntax to create a page rule which would cache all .mp3 files at Cloudflare.
https://yourdomain.com/*.mp3*
Under the settings, select the “Cache Everything” option.
Below is an example of an mp3 on a development site. You can see that it is loading from Cloudflare (server: cloudflare-nginx) and the cache status shows a “HIT,” which means it is being delivered from the CDN cache.
Summary
Hopefully, you know a little more about how to optimally offload PDF, DOCX, and MP3 hosting. Using storage solutions such as Amazon S3 and popular CDN providers can be a great way to reduce disk space, bandwidth, and save you money.