Private customers Business customers

Install Nextcloud on your VPSYour own cloud for files, calendars and contacts

Nextcloud replaces Dropbox, Google Drive and Google Calendar with an installation on your own server in Germany. This guide shows both common routes - classic with nginx and PHP or via Docker Compose - and what to consider when choosing a plan.

NextcloudDocker or nativeGDPR-friendly60 minutes

Published on

Why Nextcloud on your own VPS?

Nextcloud is free software and combines in one interface what would otherwise take several services: file storage with synchronization to all devices, calendars and contacts via CalDAV and CardDAV, notes, tasks, photo albums and, if you like, collaborative document editing.

The decisive difference from the well-known providers: the data lives on your server, in a data centre in Germany, and nobody but you has access to it. For private data, that is a matter of principle; for clubs and small businesses, it is often a matter of legal certainty.

The price for this is responsibility: updates, backups and security are up to you. If you do not want that, a hosted service serves you better - an honest recommendation includes saying so.

Rent a VPS from €2.95 / month

Prepaid without a contract, full root access.

View plans & prices

Prerequisites and choice of plan

Your Nextcloud storage is the NVMe storage of your VPS. So roughly:

  • Plan S: calendar and contact management only, few documents, one or two users.
  • Plan M: personal file storage with documents and photos, one to three users. The sensible starting size for most people.
  • Plan L or XL: family, club or small team, larger media collections, full-text search or office integration.

Nextcloud itself mainly needs memory as soon as several clients synchronize at the same time. Below 2 GB of RAM, operation becomes sluggish. You can upgrade at any time without data loss, so you can start small.

You also need a domain that points to your VPS - without it, there is no SSL certificate, and without HTTPS, the Nextcloud clients rightly refuse to connect. How to set up the DNS record is explained in Point a domain to your VPS.

Option A: Installation via Docker Compose

The quickest route if you are comfortable with Docker. It requires a working Docker installation - see Install Docker on your VPS.

Create a directory and a Compose file:

mkdir -p ~/stacks/nextcloud && cd ~/stacks/nextcloud
nano compose.yaml
services:
  db:
    image: mariadb:11
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - dbdata:/var/lib/mysql
    environment:
      MARIADB_ROOT_PASSWORD: long-random-password-one
      MARIADB_PASSWORD: long-random-password-two
      MARIADB_DATABASE: nextcloud
      MARIADB_USER: nextcloud

  redis:
    image: redis:alpine
    restart: unless-stopped

  app:
    image: nextcloud:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:80"
    depends_on:
      - db
      - redis
    volumes:
      - nextcloud:/var/www/html
    environment:
      MYSQL_HOST: db
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
      MYSQL_PASSWORD: long-random-password-two
      REDIS_HOST: redis
      NEXTCLOUD_TRUSTED_DOMAINS: cloud.yourdomain.com

volumes:
  dbdata:
  nextcloud:

Start it:

docker compose up -d
docker compose logs -f app

Note the port definition 127.0.0.1:8080:80. Nextcloud is initially only reachable from the server itself - that is how it should be. Towards the outside, you put a reverse proxy in front that handles TLS.

The Redis container is optional but highly recommended: it takes care of file locking and makes the interface noticeably faster.

Option B: Classic installation

If you do not want Docker, install Nextcloud directly. It requires nginx, PHP-FPM and MariaDB - the setup is described in the guide Set up a web server.

Additional PHP extensions that Nextcloud expects:

sudo apt install php-gd php-mbstring php-intl php-bcmath php-gmp php-imagick php-zip php-curl php-xml php-apcu -y

Create the database:

sudo mariadb
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'long-random-password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download and unpack Nextcloud:

cd /tmp
curl -LO https://download.nextcloud.com/server/releases/latest.zip
sudo apt install unzip -y
unzip latest.zip
sudo mv nextcloud /var/www/cloud.yourdomain.com
sudo chown -R www-data:www-data /var/www/cloud.yourdomain.com

Then create an nginx server block for cloud.yourdomain.com with root /var/www/cloud.yourdomain.com; and complete the installation in the browser.

Reverse proxy and SSL certificate

For the Docker option, you need nginx on the host as an intermediary. It accepts HTTPS requests and passes them on to the container:

sudo nano /etc/nginx/sites-available/cloud.yourdomain.com
server {
    listen 80;
    server_name cloud.yourdomain.com;

    client_max_body_size 10G;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

The line client_max_body_size matters more than it looks: without it, every upload above the nginx default limit of 1 MB fails.

sudo ln -s /etc/nginx/sites-available/cloud.yourdomain.com /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d cloud.yourdomain.com

After that, your Nextcloud is reachable at https://cloud.yourdomain.com. On the first visit, you create the administrator account.

After installation: the important tasks

Under Administration > Overview, Nextcloud shows a list of open items. The three most common:

  • Switch background jobs to cron. The default setting AJAX only runs maintenance tasks when someone opens the page - unreliable. Switch to cron in the settings and set up a system job:
    sudo crontab -u www-data -e
    */5 * * * * php -f /var/www/cloud.yourdomain.com/cron.php
    With the Docker option, an additional container with the command php -f /var/www/html/cron.php takes care of this.
  • Enable a memory cache. Add Redis or APCu in config/config.php - without a cache, the interface feels noticeably slower.
  • Set a maintenance window. With maintenance_window_start, you define when Nextcloud carries out compute-intensive tasks.

Then connect the clients: the desktop application is available for Windows, macOS and Linux, plus apps for Android and iOS. You add calendars and contacts via CalDAV and CardDAV - Nextcloud shows the matching addresses in the settings.

Updates and backups

How you update Nextcloud depends on the installation option. With Docker, you pull the new image and restart the stack:

cd ~/stacks/nextcloud
docker compose pull
docker compose up -d

With the classic installation, you use the built-in updater in the web interface or the command line via occ upgrade. Important in both cases: do not skip major versions. Nextcloud only supports upgrading to the next major version at a time.

For a complete backup, you need three things: the data directory, a database dump and the file config/config.php. If one of them is missing, restoring becomes tedious or impossible. How to automate this is covered in the guide Set up backups.

Before every major update: back up first, then update. With a self-hosted cloud, there is no provider who recovers the data for you.

Frequently asked questions

For personal use with documents and photos, plan M is the sensible starting size. Calendar and contact management only also runs on S. For a family, a club or a small team with larger media collections, L or XL fit better. Besides NVMe storage, memory is what matters most: below 2 GB of RAM, operation becomes sluggish as soon as several clients synchronize at the same time.

Exactly as much NVMe storage as your VPS plan comes with - minus operating system, database and application. Allow for a few gigabytes. If the space is no longer enough, you switch to a bigger plan in the customer interface without data loss.

Yes, in both variants. The classic installation with nginx, PHP and MariaDB runs without problems anyway. And because nesting is enabled on our VPS plans, the Docker option works too. Nextcloud does not need kernel modules or nested virtualization.

Yes. Without a domain, there is no SSL certificate from Let's Encrypt, and without HTTPS, the Nextcloud clients refuse the connection for good reason. A subdomain such as cloud.yourdomain.com is common, pointing to your VPS's IP address via an A record.

As secure as the way you run the server. The data lives in a data centre in Germany and nobody but you has access to it - that is the advantage. The price: updates, hardening and backups are entirely up to you. Current versions, secured SSH access, a tight firewall and regular backups to an external target are a must, not a nice-to-have.

Technically yes, but plan for the resources. The document server is by far the hungriest component of a Nextcloud installation and needs a noticeable amount of memory. On small plans, this leads to dropouts. Plan for at least plan L.

A VPS for your own cloud

Your Nextcloud storage is the NVMe storage of your plan. For personal data, M is usually enough; for a family or a small team, L or XL make sense. Located in Frankfurt am Main, prepaid without a contract.

View VPS plans & prices