How to use Nextcloud file syncing with Meshnet

Learn how to deploy a Nextcloud Docker container for remote file syncing over Meshnet.

Introduction

Nextcloud is a free and open-source online collaboration platform. It offers a wide range of tools and applications, such as file sharing and synchronization, calendar, tasks, and workflow integrations. Nextcloud is scalable from personal use to enterprise-level environments.

In standard configurations, to share your Nextcloud servers with remote devices, you must set up public domain names and SSL certificates or port forwarding, which can be both expensive and time-consuming.

With Meshnet, you can forget about the difficult networking procedures. With only a couple of tweaks to the Nextcloud configuration, your Meshnet peer devices can access the server over encrypted, private network tunnels without exposing Nextcloud to the internet.

While Nextcloud can be set up using various methods, such as a virtual machine or a standalone operating system, this article will show you how to run Nextcloud in a Docker container and access it over Meshnet.

Install Docker

To begin the configuration, you must have Docker installed on your device. Instructions on how to download and install Docker can be found on the Docker website:

Create a Nextcloud Docker container

After installing Docker on your system, you have the ability to deploy various applications and services as Docker containers. Now you can proceed with creating your Nextcloud container.

Creating a volume

First, you need to create a specific Docker volume (directory) where the container’s files will be stored.

Method 1: Using Docker Desktop

This method utilizes the Docker Desktop application to create a volume for the Nextcloud Docker container.

  1. Open the Docker Desktop application.

  2. From the menu on the left, select Volumes.

    Docker Desktop application

  3. Click the Create button in the upper-right corner.

  4. Name it nextcloud and click Create.

  5. The newly created volume will now be visible in the Volumes section.

Method 2: Using the command line

This method shows you how to create a volume for your Nextcloud Docker container via the command line.

  1. Open Command Prompt (on Windows) or Terminal (on Linux or macOS).

  2. Run the following command to create a volume called nextcloud:

    docker volume create nextcloud

If the creation was successful, you will see the name of your volume in the command line window.

Deploying a container

Once the volume has been created, you can deploy the Nextcloud container itself.

  1. Open Command Prompt.

  2. Execute the following docker run command:

    docker run -d ^
    --name nextcloud ^
    --restart=unless-stopped ^
    -p 8080:80 ^
    -v nextcloud:/var/www/html ^
    nextcloud

Docker will pull the Nextcloud image from Docker Hub and create the container.

Set up Nextcloud

With the container up and running, your Nextcloud service is listening on port 8080 (unless changed in the docker run command). To complete the initial configuration, do the following:

  1. Open your internet browser and visit this URL: http://localhost:8080/

  2. Enter authentication details for your admin account, select the preferred database, and click Install.

  3. Finish the setup procedure by following the on-screen instructions.

Now, you have a fully customizable Nextcloud instance.

Nextcloud dashboard

Allow Meshnet connections

At this time, Nextcloud is only reachable from the host device. You need to adjust its configuration file to allow connections over Meshnet.

Method 1: Using Docker Desktop

This method uses the built-in terminal in Docker Desktop to make changes.

  1. Open Docker Desktop and click your Nextcloud container entry.

  2. Switch to the Terminal tab.

  3. Run the following command to update the repository list, install Nano, and open the config.php file using Nano:

    apt update && apt install nano && nano config/config.php

  4. Locate the trusted_domains array and append the following two lines, where <NordName> is the host device’s Nord name and <MeshnetIP> is the host device’s Meshnet IP address:

    1 => '<NordName>',
    2 => '<MeshnetIP>',

    Example

    Nord name and Meshnet IP address added to the 'trusted domains' array

  5. Press Ctrl + X, Y, and Enter to save changes and exit.

  6. Restart the Nextcloud container to apply the changes by clicking the restart button in Docker Desktop.

Method 2: Using the command line

This method uses Nextcloud’s built-in command-line interface called occ.

  1. Open Command Prompt (on Windows) or Terminal (on Linux or macOS).

  2. Add new trusted domains by executing the following two commands, where <NordName> is the host device’s Nord name and <MeshnetIP> is the host device’s Meshnet IP address:

    docker exec -u www-data -it nextcloud php occ config:system:set trusted_domains 1 --value=<NordName>
    
    docker exec -u www-data -it nextcloud php occ config:system:set trusted_domains 2 --value=<MeshnetIP>

    Example

    Adding trusted domains using occ

  3. Check if the Nord name and Meshnet IP address have been assigned by running this command:

    docker exec -u www-data -it nextcloud php occ config:system:get trusted_domains

    List of trusted domains

  4. Restart the Nextcloud container to apply the changes.

    docker restart nextcloud

Connect to Nextcloud over Meshnet

After adding the Meshnet addresses to the trusted domains, your Nextcloud instance can be reached by Meshnet peer devices.

Note

If you're hosting Nextcloud on a Linux device, you must grant the local network permission for the devices accessing it. For more information, see Common issues on Linux.

Method 1: Using Nextcloud software

To use file syncing between different machines, you need to install the Nextcloud application on client devices.

Note

Folder synchronization is possible only on desktop devices. On mobile devices, you can only upload and download files manually.

  1. Download and install the Nextcloud application from the Nextcloud website.

  2. Launch Nextcloud and click Log in.

  3. In the server address field, enter http://, followed by the Nord name of the host device, and :8080.

    Example http://secret.meerkat-himalayas.nord:8080

  4. Click Next and proceed with the login procedure.

  5. Select your folder synchronization options and click Connect.

Nextcloud settings can now be accessed from the system tray (on Windows) and the menu bar (on macOS or Linux).

Tip

For ease of use, you may download the Nextcloud application from the Snap Store on compatible Linux distributions.

Method 2: Using an internet browser

To access the Nextcloud dashboard via a browser, do these steps:

  1. Copy the Nord name of the host device from the NordVPN application.

  2. Open your internet browser.

  3. Paste the copied Nord name followed by :8080/ to the URL field and press Enter. Example secret.meerkat-everest.nord:8080/

    Nextcloud login page

  4. Log in to your account.

Now you can freely navigate your Nextcloud from a remote device. You can view, upload, or remove files and use all other applications inside Nextcloud.

Nextcloud file list

Last updated

© 2024 Nord Security. All Rights Reserved.