How to use Object Storage for WordPress media files
Object storage is a popular solution for storing large amounts of static, unstructured data thanks to its scalability and API-friendly nature. It’s often used for serving data analysis software but also offers many other opportunities, for example, saving media files on Object Storage for WordPress hosting.
WordPress sites that work with rich media content could greatly benefit from using Object Storage to host their videos, photos, and audio files. In this tutorial, we’ll show you how easy it is to integrate Object Storage with your WordPress site with no coding necessary.
Why use Object Storage for WordPress?
A large portion of the websites across the world run on WordPress, and for a reason. It provides a powerful platform to build just about anything you want with great features and easily customisable designs. Yet it could still be improved by pairing it with a simple Object Storage.
One of the goals of any website is to grow to attract new visitors. This naturally required the ability to scale as your needs increase. Object Storage enables you to easily add storage space for your images, videos and other media files. Furthermore, even the starting plan for Object Storage includes a generous amount of storage capacity.
Security is another necessity for a WordPress host of any size. That is not a problem with Object Storage, our security-first design principles enforce HTTPS in transit while all data is stored securely on redundancy enabled backend.
However, these are but a couple of examples of the benefits of Object Storage offers for WordPress hosting. Learn more by checking out our blog post on Object Storage for WordPress Companies.
Creating a new Object Storage instance
To start with, you will need an Object Storage instance. If you don’t already have one, create a new one to upload your media files into. You can of course use existing Object Storage as well and simply create a new bucket for your WordPress media files.
You can get started quickly with Object Storage by following our tutorial.
Alternatively, if you are using Terraform for your cloud infrastructure needs, you might be interested in configuring your Object Storage using our Terraform plugin.
Installing Media Cloud WordPress plugin
Once you have an Object Storage instance ready and available, you can begin integrating it with your WordPress site. The easiest way to go about this is using an S3 compliant WordPress plugin, for example, Media Cloud.
The reason we are using this specific plugin is that Media Cloud allows you to use custom endpoints. This enables it to work with UpCloud’s Object Storage out of the box. Other plugins might be able to do the same, so just pick whichever you prefer.
On a standard WordPress site, you can install Media Cloud straight from the plugin library. Go to the Add New section under the Plugins menu and search for “Media Cloud”.
When you’ve found the plugin, click the Install button to add it to your WordPress site.
Once installed, you will then need to activate the plugin by clicking the Activate button.
After activating, the plugin will prompt you with the option to enable or skip update notifications and diagnostic tracking. This is up to your preference and won’t affect the functionality of the plugin.
That’s it for the installation itself! After you’ve selected whether to allow or skip the notifications and diagnostics, you will be presented with the guided setup wizard. Continue ahead in the next section on how to go about connecting your Object Storage.
Connecting Media Cloud to Object Storage
After installing and activating the Media Cloud plugin, you will see the welcome page of the configuration wizard. Simply click the Next button to start.
Next, select the S3 Compatible storage provider and again click the Next button.
You will then be presented with an explanation of what the S3 compatibility offers. UpCloud Object Storage is fully S3 compliant ensuring compatibility with a wide variety of software and integrations.
Click the Next button to continue.
Object Storage access details
Now, in the step for Cloud Storage Settings, you need to enter your Object Storage access details. These include the Access and Secret keys as well as the public endpoint URL and bucket of your Object Storage.
- Your Access and Secret keys were presented upon Object Storage creation. You likely downloaded the key file. If you can’t find these, you’ll need to generate new credentials in the Object Storage settings.
- The public endpoint used in the Custom endpoint field can be found in the S3 API access options in your Object Storage details.
- Lastly, the bucket name can be anything. Simply enter the name of a bucket in your Object Storage where you want the WordPress media files saved. Note that you will need to enable public anonymous HTTPS access to the files in the bucket settings.
Once you’ve filled in the access details, click the Next button again to continue.
Following the configuration, Media Cloud will then run a series of tests to verify everything is working.
Click the Start Tests button to confirm.
You should then see the results of the tests roll in, each successful test showing green. If you get an error in verifying public accessibility, check that you’ve enabled anonymous HTTPS access to the bucket you configured for Media Cloud.
Once Media Cloud has verified access, click the Next button.
If everything went according to plan, you should then see a confirmation that Media Cloud was set up correctly. Simply click the Finish & Exit Wizard button to head back to your WordPress admin panel.
Additional Media Cloud settings
Now that you’ve connected WordPress with your Object Storage, you are almost ready to test it out. However, before that, there are a few additional settings you might wish to enable.
Go to the Cloud Storage settings under the Media Cloud menu and scroll down to Upload Handling.
Here you can see a few helpful features that will allow you to utilise your Object Storage as if it were just an extension of your Cloud Server.
Enable the settings you want. For the most streamlined experience, we recommend turning on the following options:
- Overwrite Existing Files
- Delete Uploaded Files
- Queue Deletes
- Delete From Storage
You can read the descriptions for each option at your WordPress site.
Testing the file upload
Having created and connected your Object Storage instance, you are then ready to start uploading your files to it. You can now do this directly from your WordPress Media library!
Go to the Add New option for your Media section. Then click the Select Files button or simply drag and drop files to the upload box.
Once you’ve uploaded something, you should see a confirmation of the upload on the same page. You can then verify the upload was successful by viewing the files in your Object Storage.
As you can see in the example above, WordPress scaled the uploaded image to a number of different sizes. You could then embed these into any of your WordPress pages or posts as if they were stored on your WordPress host.
Congratulations! You should now have integrated your Object Storage instance with your WordPress site greatly increasing your media usage possibilities.
Object Storage also supports any S3 compliant software for managing your data. If you want to explore other options for this, check out our tutorial for Object Storage which includes examples of easy to use file management clients. Alternatively, you might be interested in the S3cmd command-line client or mounting your Object Storage to your Cloud Server using s3fs-fuse.