Use FPT Object Storage as a WordPress media server
Storing WordPress media in FPT Object Storage takes load and disk space off your web server and lets browsers download images and videos directly from the bucket. This guide uses the Media Cloud plugin; other plugins work in a similar way.
Why use a bucket for media
- Lighter web server: the server no longer stores or delivers media files, so its resources go to page requests.
- Lower cost: object storage costs less than server disk, browsers download media without using the bandwidth of your web server, and you pay only for the storage you use.
- Independent storage: media stays in the bucket when you move the website to another server, so you do not need to migrate files or update links.
- Faster pages: data centers in Hanoi and Ho Chi Minh City keep domestic download speeds stable, and data stays in Vietnam in line with Decree 53/2022.
Prerequisites
- A website running on WordPress.
- FPT Object Storage enabled for your account.
- The endpoint of your region. See Manage Access Keys.
How it works
WordPress cannot store files in S3 by itself. A plugin hooks into the WordPress uploader: after WordPress uploads a file, the plugin copies it to FPT Object Storage, deletes the local copy, and rewrites the media links to point to the bucket. Plugins that do this include WP Offload Media Lite, Media Cloud, Media Library Folders Pro S3, and W3 Total Cache.
Create a bucket for media
- Create a bucket for the media files of the website, on the Portal or with S3 Browser.
- Make the objects public so that browsers can load them. See Manage permissions.
- Protect the bucket. Anyone with the key and endpoint can change or delete its objects, so a stolen key could wipe out your media:
- Enable Versioning to keep previous versions of changed objects.
- Add a Bucket Policy that limits the IP addresses allowed to write, or the file extensions allowed to upload.
- Back up the bucket to another bucket.
Create a SubUser for WordPress
An Admin Access Key works for a quick test, but do not keep it in WordPress. If it leaks, someone could delete the data in every bucket. Create a SubUser that can access only the media bucket, and use its key in the plugin. See Manage SubUsers and Grant per-bucket access to SubUsers.
Install and configure Media Cloud
- In the WordPress admin panel, go to Plugins, then find and install Media Cloud.
- Activate the plugin and enter the endpoint, the SubUser Access Key and Secret Key, and the bucket name.
- After the connection succeeds, adjust the basic settings.
- In UPLOAD HANDLING, select the file types to upload to the bucket.
- Enable Delete From Storage so that deleting media in WordPress also deletes it from the bucket.
- Upload a test image in WordPress, then check that it appears in the bucket.
From now on, WordPress stores new media in the bucket.
The free version of Media Cloud does not move files uploaded before the plugin was installed. Moving existing files requires the Premium version.