Skip to main content

NextCloud with CloudFlare Tunnels

We're going to take a look at getting NextCloud up and running with Docker, Portainer, and CloudFlare Tunnels. 

This post will be a companion piece to the video and will really only have the different bits that I updated in the video.

NextCloud Docker Compose

Uptime-Kuma Docker Compose

We need to edit some files in the NextCloud Docker container, so log into Portainer and find the >_ icon next to your NextCloud container.

Click that icon.

Click the blue Connect button.

In the terminal window, enter the following:

apt update
apt install nano
nano .htaccess

This will update our repositories, install the nano editor, and then open the .htaccess file with nano.

Add the following to the top of the .htaccess in your NextCloud container:

php_value upload_max_filesize 16G
php_value post_max_size 16G
php_value max_input_time 3600
php_value max_execution_time 3600
php_value memory_limit 2048M

Save and exit with CTRL+o and then CTRL+x

Now we'll edit the config.php file with:

nano config/config.php

Scroll down until you find the 'trusted_domains' section:

'trusted_domains' => 
  array (
    0 => '192.168.1.65:8080',
),

You'll want to add another line so that it look similar to this:

'trusted_domains' => 
  array (
    0 => '192.168.1.65:8080',
    1 => 'cloud.dbt3ch.com',
  ),

Then scroll down to the bottom of the file where you should see:

'installed' => true,

And add the following before the last ");":

'overwriteprotocol' => 'https',
'default_phone_region' => 'US',
'enable_previews' => true,

Save and exit with CTRL+o and then CTRL+x

Now we'll edit the 000-default.conf file with:

nano /etc/apache2/sites-enabled/000-default.conf

Scroll to the end of the file and add the following:

Redirect 301 /.well-known/carddav https://cloud.dbt3ch.com/remote.php/dav
Redirect 301 /.well-known/caldav https://cloud.yoursite.com/remote.php/dav
Redirect 301 /.well-known/webdav https://cloud.yoursite.com/remote.php/dav
Redirect 301 /.well-known/webfinger https://cloud.yoursite.com/index.php
Redirect 301 /.well-known/nodeinfo https://cloud.yoursite.com/index.php

Of course, make sure that the cloud.yoursite.com is your NextCloud URL.

Once you've made all these changes, be sure to restart your NextCloud Docker container.