Virteche
Guideschevron_rightServers

Servers · 9 min read · Updated

How to Self-Host Nextcloud on a VPS

The simplest way to run Nextcloud on your own server is Nextcloud All-in-One (AIO), the official Docker setup. You start one container, open its web interface, enter your domain, and it installs Nextcloud with HTTPS, a database, caching and optional extras such as office editing and video calls. Its built-in BorgBackup sends encrypted, deduplicated backups to another server every night, such as a storage box. You then sync files from the Nextcloud desktop and phone apps, the same way you would with Dropbox or Google Drive.

1. Prepare the Server and Domain

Start from first steps on a new Linux server and install Docker. At your DNS provider, add an A record for the name you will use, such as cloud.example.com, with the server's IP address.

Ports: 443 for Nextcloud, 80 for its certificate, and 8080 for the AIO interface during setup. If you turned on the firewall on your server's page in the dashboard, allow 80 and 443 from anywhere and 8080 from your own address only. Docker's ports skip UFW, so the dashboard firewall is the one that counts here.

2. Start Nextcloud All-in-One

sudo docker run \
  --init \
  --sig-proxy=false \
  --name nextcloud-aio-mastercontainer \
  --restart always \
  --publish 80:80 \
  --publish 8080:8080 \
  --publish 8443:8443 \
  --volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
  --volume /var/run/docker.sock:/var/run/docker.sock:ro \
  ghcr.io/nextcloud-releases/all-in-one:latest

Open https://203.0.113.10:8080 (your server's address) and accept the self-signed certificate warning, which is expected for this setup page. Note the passphrase AIO shows you: it is the only way back into this interface.

3. Enter Your Domain and Install

Enter cloud.example.com. AIO checks the domain points at the server, then lets you choose optional containers (office editing, Talk for video calls, full-text search) and your time zone. Start the containers and wait: the first start downloads several images and takes a few minutes. AIO then shows the admin username and password for Nextcloud itself.

4. Back Up to a Storage Box

In the AIO interface, open the backup section and choose a remote Borg repository. For a Virteche storage box:

ssh://[email protected]:23/./nextcloud-aio

AIO shows the SSH public key it connects with. Add it under SSH keys on the storage box's page in your dashboard, then run the first backup from AIO and set the daily backup time. Keep the backup encryption password AIO gives you somewhere other than the server: without it the backups cannot be restored.

The storage box's own scheduled snapshots add a copy that nothing connecting over SSH can change, which protects the backups if the Nextcloud server is ever compromised. See snapshots.

5. Connect Your Devices

Install the Nextcloud desktop app (Windows, macOS, Linux) and the phone app (iOS, Android), and sign in with https://cloud.example.com. Choose which folders to sync. The phone app can upload photos automatically, which replaces Google Photos or iCloud uploads for many people.

6. Keep It Updated

AIO updates Nextcloud and its containers from its own interface, and can do it automatically after each daily backup. Leave that on. The server underneath still needs its own security updates, which first steps on a new Linux server turns on.

Common Questions

  • How big a server does Nextcloud need?

    For a family or small team, 2 to 4 vCPU and 4 to 8 GB of memory, plus enough disk for your files. Office editing, video calls and many users need more. Disk is usually what runs out first.

  • Can my files live on a storage box instead of the server's disk?

    For archives, yes: Nextcloud's External storage app can mount a storage box over SFTP (host bend.storage.virteche.com:23). Keep the files you work with every day on the server's own disk; every read over the network is slower.

  • What if the remote Borg backup will not connect?

    Set AIO's backup location to a folder on the server instead, then copy that folder to a storage box nightly with rsync, after the backup has finished. Restores work the same way from the copied folder.

  • Is Nextcloud end-to-end encrypted?

    Not by default. Files are encrypted in transit with HTTPS and stored on your own server, which only you administer. Nextcloud has an optional end-to-end encryption feature for individual folders.

KVM servers with NVMe storage in Ashburn and Dallas, and storage boxes for Nextcloud's backups.

See VPS plans

Keep Reading

All guides