R2 for Nextcloud backend?

Has anyone tried to use R2 for backend to Nextcloud?
Does the S2-backend in Nextcloud support connecting to R2?

Hi there,
Thanks for reaching out to the Cloudflare community!
At this time, I found no practical cases of integrating R2 and Nextcloud
I found a related topic on Reddit here that might be useful: https://www.reddit.com/r/backblaze/comments/keeqqp/nextcloud_b2_and_cloudflare/

Nevertheless, if you do experiment with this please let us know the outcome!

Kind regards.

1 Like

mmm. that looks a bit too complicated for me, but if someone wants to work on this with me let me know!

I just got mine working. Using these instructions:

The only change I had to make was the Region, which I set to “Auto” to get it to work with R2.

The Folder Name is where external storage will show up in any account that has access to this feature.

1 Like


Following these instructions:

If you want to use R2 as your primary storage on a new Nextcloud setup, put this in config.php:

    'objectstore' => [
        'class' => '\\OC\\Files\\ObjectStore\\S3',
        'arguments' => [
                'bucket' => 'BUCKET',
                'autocreate' => true,
                'key'    => 'KEY',
                'secret' => 'SECRET',
                'hostname' => 'ACCOUNT_ID.r2.cloudflarestorage.com',
                'port' => 443,
                'use_ssl' => true,
                'region' => 'auto',

Please note that I am still experimenting with this part of the setup on an experimental Nextcloud installation.

And please know that this will replace your /data directory with empty content. (it won’t empty the /data directory on your server, but that’s how it will appear in Nextcloud – no more user data)

If you do this on a running Nextcloud installation, you will no longer be able to access any of your old data.

* If in doubt, back everything up before attempting this.

Do not use this if you already have data in Nextcloud

1 Like