How to use DigitalOcean Spaces with Wordpress ?

Muhammet Arslan
Muhammet Arslan
Published in
3 min readApr 8, 2018

Hi guys,

Recently, DigitalOcean released its s3-compatible storage feature, called “Spaces”. They are explaining their new feature as below;

Securely store and deliver any amount of data to end-users and applications, with the same simplicity you’ve come to expect from us. Instantaneously create cost-effective, reliable storage space using our drag-and-drop UI or API.

One of my customers came to me and requested to move websites local storage to DigitalOcean spaces to make it faster, CDN enabled and secure. And I started to discover how to use it ?

DigitalOcean Spaces Wordpress Plugin

There is a plugin in Wordpress plugin market, called “DigitalOcean Spaces Sync”. With the help of that plugin, you can easily sync your media library with DigitalOcean spaces. To setup that plugin,

  • First, go to Digitalocean.com -> API -> Spaces access keys -> Generate New Key and copy the access and secret keys.
  • Download the plugin and activate it from plugins menu.
  • Go to Settings -> DigitalOcean spaces sync menu and fill the fields with your informations.
  • Click “check the configurations” button to check your setup.
  • After you got an “okay”, fill the below configurations too.
  • Then “save” them.

How to move previous files to the DigitalOcean Spaces ?

Because Spaces is using S3 backend APIs, we can easily use “rclone” (or any other s3 driver / tools ) to moving our files all together.

At first, setup “rclone” on your droplet / server.

After you installed the rclone, configure it.

rclone config
  • To create a new remote type “n” and press enter.
  • Give a name to your remote ( To prevent any bugs, just use english letters without spaces)
  • For Storage, type “s3” for DigitalOcean Spaces.
  • Type “1” to enter our Spaces Credentials
  • For “access_key_id”, paste your access key
  • For “secret_access_key”, paste your secret key
  • Leave empty on the “region” field, just press “enter”
  • Type your space url without your space name (i.e : ams3.digitaloceanspaces.com )
  • Leave empty on the “location_constraint” field, just press “enter”
  • For “acl” field, to make your files “publicly readable” type “2”.
  • Leave empty on the “server_side_encryption” field, just press “enter”
  • Leave empty on the “storage_class” field, just press “enter”
[muhammet-test]
type = s3
env_auth = false
access_key_id = test
secret_access_key = test
region =
endpoint = ams3.digitaloceanspaces.com
location_constraint =
acl = public-read
server_side_encryption =
storage_class =
  • If the configuration summary is okay for you, type “y” to the prompt.
  • And type “q” to quit.

Now your rclone is ready for the main space. But you need to introduce your DigitalOcean Space with Rclone.

rclone mkdir muhammet-test:your-space-name

Than everything is ready for the sync.

rclone copy /var/www/muhammet-test/wp-content/uploads/ muhammet-test:your-space-name

Now, all the files are syncing.

Thanks,

King Regards,

--

--