Connect DigitalOcean Spaces to WordPress
To offload WordPress media to DigitalOcean Spaces, install Offloft, create a Spaces bucket and a limited access key for it, then copy the key into Offloft. Offloft marks each file it uploads as public, so there is nothing to switch on. It tests delivery before serving.
What you'll need
- A DigitalOcean account
- A WordPress admin login
- Offloft installed (WordPress 6.5 or later and PHP 8.1 or later with the cURL extension)
- 1
Create the bucket
In the DigitalOcean control panel, go to Spaces Object Storage and select Create Spaces Bucket.
Region: pick the datacenter closest to most of your visitors and enter the same region (for example nyc3) in Offloft.
Name: lowercase letters, numbers and hyphens, unique within the region. Leave the CDN off for now.
Bucket namemy-site-media
Open DigitalOcean Spaces's consoleDigitalOcean Spaces's documentation
- 2
Create an access key for this bucket
Go to Spaces Object Storage, open the Access Keys tab and select Create Access Key.
Choose Limited Access, pick "my-site-media" and set its permission to Read/Write/Delete. Full Access also works, but reaches every bucket on your account.
Copy the Access Key ID and the Secret Key into Offloft. DigitalOcean shows the secret only once.
Open DigitalOcean Spaces's consoleDigitalOcean Spaces's documentation
- 3
Let visitors read the files
Spaces keeps every file private unless the file itself is marked public. Offloft marks each file it uploads as public; the delivery check confirms it works. There is nothing to switch on.
Keep the bucket's File Listing setting on Restricted, so visitors can open a file but cannot list them all.
Files uploaded to the bucket by other tools stay private until you mark them public in the control panel.
Open DigitalOcean Spaces's consoleDigitalOcean Spaces's documentation
- 4
Turn on the CDN and use your own domainOptional
Open the bucket, go to Settings > CDN, select Edit and Enable CDN. Files are then also served from my-site-media.your-region.cdn.digitaloceanspaces.com.
To use media.yoursite.com instead, choose Add a New Subdomain. If your domain's DNS is managed by DigitalOcean, it can issue a free Let's Encrypt certificate; otherwise upload your own certificate.
In Offloft, use https://media.yoursite.com (or the CDN address) as the delivery address.
CDN addresshttps://my-site-media.your-region.cdn.digitaloceanspaces.com
Delivery addresshttps://media.yoursite.com
Open DigitalOcean Spaces's consoleDigitalOcean Spaces's documentation
- 5
Allow your site to read files (CORS)Optional
This step is optional. Images on your pages load without it. You need it only when your site's own scripts read files from storage, for example image editors, web fonts or 3D viewers. The rule below lets only your site read files, and only read them.
Open the bucket, go to Settings > CORS Configurations and select Add. Enter your site's address below as the origin, allow GET and HEAD, and save.
Originhttps://yoursite.com
Open DigitalOcean Spaces's consoleDigitalOcean Spaces's documentation
- 6
Run the connection test and the delivery check
In Offloft, paste your values and run the connection test. It checks your credentials, finds the bucket, uploads a test file, reads it back and deletes it. The delivery check then loads a small test image from your public address. Offloft serves nothing from the cloud until both pass.
Permissions Offloft needs
A Limited Access key with Read/Write/Delete on this bucket. Full Access also works, but it reaches every bucket on your account.
Serving your files
Spaces keeps every file private unless the file itself is marked public. Offloft marks each file it uploads as public, and the delivery check confirms it works. You can turn on the CDN, and use your own domain, in the bucket's settings.
If the test fails
DigitalOcean Spaces questions
Do I need to make the bucket public?
No. Offloft marks each file it uploads as public. Keep File Listing on Restricted, so visitors can open a file but can't list them all.
What about files uploaded by other tools?
They stay private until you mark them public in the control panel.
Should I turn on the CDN?
You can, in the bucket settings. Leave it off while you create the bucket, then follow the optional domain step.
Ready to connect your bucket?
Install Offloft free. Nothing moves until the connection test passes.