HomeStart / GuidesAnleitungen / Self-hosting Nextcloud properly/ Nextcloud richtig selbst hosten

Self-hosting Nextcloud properly: storage, cron, and the settings everyone gets wrongNextcloud richtig selbst hosten: Speicher, Cron und die Einstellungen, die alle falsch machen

Nextcloud installs in ten minutes and then spends two years being mysteriously slow. Almost all of it comes down to four settings and one decision about where the files live.Nextcloud ist in zehn Minuten installiert – und ist danach zwei Jahre lang rätselhaft langsam. Fast alles davon lässt sich auf vier Einstellungen und eine Entscheidung zurückführen: wo die Dateien wirklich liegen.

Decide the shape firstEntscheide zuerst die Form

There are three sane ways to run it, and picking the wrong one is the expensive mistake.Es gibt drei vernünftige Wege, Nextcloud zu betreiben – und die falsche Wahl ist der teure Fehler.

What is not a sane way: SQLite. Nextcloud will let you, and it works right up until two devices sync at once.Was keine vernünftige Wahl ist: SQLite. Nextcloud lässt es zu, und es funktioniert – bis genau der Moment kommt, in dem zwei Geräte gleichzeitig synchronisieren.

Sizing: it is a disk problem, not a CPU problemDimensionierung: Es ist ein Speicherplatz-Problem, kein CPU-Problem

Nextcloud is a file server with a web UI. CPU matters for thumbnail generation and the occasional big scan; the thing that actually runs out is disk.Nextcloud ist ein Dateiserver mit Weboberfläche. CPU spielt für die Vorschaubild-Erzeugung und gelegentliche große Scans eine Rolle; was dir tatsächlich ausgeht, ist der Speicherplatz.

Budget for what you will store in two years, not what you have today, and remember the multiplier: a file that exists on your laptop, your phone and the server exists three times, and versioning keeps old copies of anything you edit. 2 GiB of RAM is a comfortable floor for a small household instance with Redis alongside; the database is small unless you have hundreds of thousands of files.Plane für das, was du in zwei Jahren speicherst, nicht für das, was du heute hast, und denk an den Multiplikator: Eine Datei, die auf Laptop, Handy und Server existiert, liegt dreifach vor, und die Versionierung hebt alte Kopien von allem auf, was du bearbeitest. 2 GiB RAM sind eine komfortable Untergrenze für eine kleine Instanz im Haushaltseinsatz mit Redis daneben; die Datenbank ist klein, solange du nicht Hunderttausende Dateien hast.

If the disk is the constraint, plan how you grow it before you fill it — add extra storage to your VPS covers the mechanics on our machines.Wenn der Speicherplatz der begrenzende Faktor ist, plane das Wachstum, bevor er voll ist — Speicherplatz zu deinem VPS hinzufügen beschreibt die Mechanik auf unseren Maschinen.

The compose fileDie Compose-Datei

services:
  db:
    image: mariadb:11.4
    restart: unless-stopped
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    environment:
      - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MARIADB_DATABASE=nextcloud
      - MARIADB_USER=nextcloud
      - MARIADB_PASSWORD=${DB_PASSWORD}
    volumes:
      - db:/var/lib/mysql

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

  app:
    image: nextcloud:30-apache
    restart: unless-stopped
    depends_on: [db, redis]
    environment:
      - MYSQL_HOST=db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=${DB_PASSWORD}
      - REDIS_HOST=redis
      - NEXTCLOUD_TRUSTED_DOMAINS=cloud.example.com
      - OVERWRITEPROTOCOL=https
      - PHP_MEMORY_LIMIT=512M
      - PHP_UPLOAD_LIMIT=10G
    volumes:
      - nextcloud:/var/www/html
    ports:
      - "127.0.0.1:8080:80"

  cron:
    image: nextcloud:30-apache
    restart: unless-stopped
    depends_on: [db, redis]
    volumes:
      - nextcloud:/var/www/html
    entrypoint: /cron.sh

volumes:
  db:
  nextcloud:

The fourth service is not optional, and it is the one most guides leave out. Read on.Der vierte Service ist nicht optional, und er ist der, den die meisten Anleitungen weglassen. Lies weiter.

The four settings everyone gets wrongDie vier Einstellungen, die alle falsch machen

1. trusted_domains. Nextcloud refuses any hostname it was not told about, with a blunt "access through untrusted domain" page. Set it at install (NEXTCLOUD_TRUSTED_DOMAINS above) or fix it later in config/config.php. Add every name you will really use, including the one you use from inside your own network.1. trusted_domains. Nextcloud verweigert jeden Hostnamen, von dem es nichts weiß, mit der schroffen Meldung „Zugriff über nicht vertrauenswürdige Domain“. Setze sie bei der Installation (NEXTCLOUD_TRUSTED_DOMAINS oben) oder korrigiere sie später in config/config.php. Trag jeden Namen ein, den du wirklich benutzt, auch den aus deinem eigenen Netzwerk.

2. overwriteprotocol. Behind a reverse proxy that terminates TLS, PHP sees plain HTTP and starts generating http:// links inside an https:// page. Browsers block them and the UI half-breaks. OVERWRITEPROTOCOL=https fixes it. If your proxy is on a different host, set trusted_proxies too, or every login shows up in the logs from the proxy's address instead of the user's.2. overwriteprotocol. Hinter einem Reverse-Proxy, der TLS terminiert, sieht PHP nur einfaches HTTP und erzeugt http://-Links innerhalb einer https://-Seite. Browser blockieren sie, und die Oberfläche wirkt halb kaputt. OVERWRITEPROTOCOL=https behebt das. Läuft dein Proxy auf einem anderen Host, setze zusätzlich trusted_proxies, sonst taucht jeder Login in den Logs mit der Adresse des Proxys statt der des Nutzers auf.

3. Background jobs. A default install runs its background jobs via AJAX, meaning "when somebody happens to load a page". File scans, previews, cleanup and notifications then run late or never, and the instance feels slower every month. The cron service above is the fix: the same image with /cron.sh as the entrypoint, sharing the volume. Then set the method to Cron in Administration → Basic settings.3. Hintergrundaufgaben. Eine Standardinstallation führt ihre Hintergrundaufgaben per AJAX aus, das heißt „immer wenn zufällig jemand eine Seite lädt“. Dateiscans, Vorschauen, Aufräumarbeiten und Benachrichtigungen laufen dann verspätet oder gar nicht, und die Instanz fühlt sich jeden Monat langsamer an. Der cron-Service oben ist die Lösung: dasselbe Image mit /cron.sh als Entrypoint, das sich das Volume teilt. Stelle danach unter Verwaltung → Grundeinstellungen die Methode auf Cron um.

4. Upload limits. They are enforced in three places and the smallest wins: PHP (PHP_UPLOAD_LIMIT), the reverse proxy body size, and any intermediate CDN. Raising one and forgetting the others is why "it fails at exactly 512 MB".4. Upload-Limits. Sie werden an drei Stellen durchgesetzt, und die kleinste gewinnt: PHP (PHP_UPLOAD_LIMIT), die Body-Size-Grenze des Reverse-Proxys und ein eventuell zwischengeschaltetes CDN. Wenn du nur eine davon erhöhst und die anderen vergisst, scheitert es „ausgerechnet bei genau 512 MB“.

HTTPS and the proxyHTTPS und der Proxy

cloud.example.com {
    reverse_proxy 127.0.0.1:8080
    request_body {
        max_size 10GB
    }
    header {
        Strict-Transport-Security "max-age=31536000;"
    }
    redir /.well-known/carddav /remote.php/dav 301
    redir /.well-known/caldav /remote.php/dav 301
}

Those two redirects are what silence the "your web server is not properly set up to resolve /.well-known/caldav" warning, and without them contact and calendar sync in some clients simply does not find the server. Point the DNS record first — point your domain at your service if you have not done that before.Diese beiden Weiterleitungen sind es, die die Warnung „dein Webserver ist nicht richtig eingerichtet, um /.well-known/caldav aufzulösen“ zum Schweigen bringen; ohne sie finden Kontakt- und Kalender-Sync in manchen Clients den Server schlicht nicht. Richte zuerst den DNS-Eintrag ein — deine Domain auf deinen Dienst zeigen lassen, falls du das noch nicht gemacht hast.

After the install: run the checksNach der Installation: die Prüfungen durchführen

The admin overview page has a security & setup warnings section. Do not treat it as decoration; it is a genuine checklist. The two that matter most on a fresh install:Die Admin-Übersichtsseite hat einen Bereich für Sicherheits- und Einrichtungswarnungen. Behandle ihn nicht als Dekoration; es ist eine echte Checkliste. Die zwei, die bei einer frischen Installation am meisten zählen:

docker compose exec -u www-data app php occ db:add-missing-indices
docker compose exec -u www-data app php occ db:add-missing-primary-keys

Nextcloud ships new indices with new versions but will not add them to a live database on its own, and a table without them gets slow in a way that looks like "the server is underpowered".Nextcloud liefert mit neuen Versionen neue Indizes aus, fügt sie aber nicht von selbst zu einer laufenden Datenbank hinzu, und eine Tabelle ohne sie wird auf eine Art langsam, die wie „der Server ist zu schwach“ aussieht.

BackupsBackups

Three things, and you need all three:Drei Dinge, und du brauchst alle drei:

  1. the databasemysqldump (or mariadb-dump) of the nextcloud database;die Datenbankmysqldump (oder mariadb-dump) der Datenbank nextcloud;
  2. the data directory — the files themselves, which is the big one;das Datenverzeichnis — die Dateien selbst, das ist der große Brocken;
  3. config/config.php — small, and irritating to reconstruct.config/config.php — klein, aber ärgerlich zu rekonstruieren.

Put the instance into maintenance mode first so the dump and the files agree with each other:Versetze die Instanz zuerst in den Wartungsmodus, damit Dump und Dateien zueinander passen:

docker compose exec -u www-data app php occ maintenance:mode --on
# dump the database, copy the data directory
docker compose exec -u www-data app php occ maintenance:mode --off

Copy the result off the machine. Nothing about self-hosting includes a backup by default — that part is yours to arrange, on any provider. back up your VPS is our own write-up of what that means in practice.Kopiere das Ergebnis von der Maschine herunter. Self-Hosting bringt von Haus aus kein Backup mit — das musst du selbst organisieren, bei jedem Anbieter. Backup deines VPS ist unser eigener Leitfaden dazu, was das in der Praxis bedeutet.

On overnight.hostBei overnight.host

Full disclosure: this is what we sell. If you want the app without the sysadmin, we run Nextcloud as a managed container with its own volume and hostname — you get the app and a URL, not a root shell.Zur vollen Transparenz: Das ist, was wir verkaufen. Willst du die App ohne die Systemadministration, betreiben wir Nextcloud als gemanagten Container mit eigenem Volume und Hostnamen — du bekommst die App und eine URL, keine Root-Shell.

One-click apps — EUR 4 to EUR 12 a month, hosted in Germany (EU). Eight apps: n8n, Uptime Kuma, Vaultwarden, Gitea, Nextcloud, Ghost, Managed WordPress, Private AI Chat. Each customer gets an isolated Docker network and volume, plus a hostname under apps.overnight.host on a real wildcard certificate. Memory and CPU are capped per plan by the container runtime.One-Click-Apps — 4 bis 12 EUR im Monat, gehostet in Deutschland (EU). Acht Apps: n8n, Uptime Kuma, Vaultwarden, Gitea, Nextcloud, Ghost, Managed WordPress, Private AI Chat. Jeder Kunde bekommt ein isoliertes Docker-Netzwerk und -Volume sowie einen Hostnamen unter apps.overnight.host mit einem echten Wildcard-Zertifikat. Arbeitsspeicher und CPU sind je Plan durch die Container-Runtime gedeckelt.

You order in the shop, pay by card (Stripe) or SEPA bank transfer, and your login details are e-mailed to you once the service is set up. Support is e-mail, run by one person, with no guaranteed response time. All prices are final totals under the German small-business rule (§19 UStG); no VAT is added or shown.Du bestellst im Shop, zahlst per Karte (Stripe) oder SEPA-Überweisung, und deine Zugangsdaten werden dir per E-Mail zugeschickt, sobald der Dienst eingerichtet ist. Support läuft per E-Mail, von einer einzelnen Person betrieben, ohne garantierte Reaktionszeit. Alle Preise sind Endpreise. Gemäß § 19 UStG wird keine Umsatzsteuer ausgewiesen.

Order one-click-nextcloud → · One-click apps overviewOne-Click-Nextcloud bestellen → · Übersicht One-Click-Apps

Written by the person who runs overnight.host: a small, honest hosting company on dedicated bare metal — Linux VPS, game servers, web hosting. Live status at up.overnight.host.Geschrieben von der Person, die overnight.host betreibt: ein kleines, ehrliches Hosting-Unternehmen auf dedizierter Bare-Metal-Hardware — Linux-VPS, Gameserver, Webhosting. Live-Status unter up.overnight.host.

Technical guidance is informational. Plans, specifications and final prices are listed in the shop and can be ordered directly; VPS, game server, web hosting, one-click app and automation plans are provisioned automatically after payment. Custom configurations are still arranged by e-mail.Technische Hinweise dienen der Information. Pläne, Spezifikationen und Endpreise stehen im Shop und können direkt bestellt werden; VPS-, Gameserver-, Webhosting-, One-Click-App- und Automatisierungs-Pläne werden nach der Zahlung automatisch bereitgestellt. Sonderkonfigurationen werden weiterhin per E-Mail vereinbart.

FAQFAQ

How much disk does Nextcloud need?Wie viel Speicherplatz braucht Nextcloud?

As much as the files, plus room for file versions and the trash, plus the previews it generates. Size for what you expect in two years rather than what you have now, and check the versioning and retention settings early — they are the quiet consumers.So viel wie die Dateien selbst, plus Platz für Dateiversionen und den Papierkorb, plus die generierten Vorschaubilder. Plane für das, was du in zwei Jahren erwartest, statt für das, was du jetzt hast, und prüfe früh die Versionierungs- und Aufbewahrungseinstellungen — sie sind die stillen Verbraucher.

Can I use SQLite?Kann ich SQLite verwenden?

Only for a look-around. Nextcloud supports it, but it serialises writes and falls over as soon as two clients sync at the same time. MariaDB or PostgreSQL for anything you intend to keep.Nur zum Ausprobieren. Nextcloud unterstützt es, aber es serialisiert Schreibzugriffe und bricht zusammen, sobald zwei Clients gleichzeitig synchronisieren. Für alles, was Bestand haben soll, MariaDB oder PostgreSQL.

Why are my uploads failing at a fixed size?Warum scheitern meine Uploads bei einer festen Größe?

Something in the chain has a body-size limit smaller than the file. Check PHP's upload and post limits, the reverse proxy's max body size, and any CDN in front. The smallest number wins, and it is usually the proxy.Irgendwo in der Kette gibt es ein Body-Size-Limit, das kleiner ist als die Datei. Prüfe PHPs Upload- und Post-Limits, die maximale Body-Size des Reverse-Proxys und ein eventuelles CDN davor. Die kleinste Zahl gewinnt, und meistens ist es der Proxy.

Do I need Redis?Brauche ich Redis?

Strongly recommended. Nextcloud uses it for transactional file locking and caching; without it you eventually meet the "file is locked" errors under concurrent sync. It costs a few megabytes of RAM.Dringend empfohlen. Nextcloud nutzt es für transaktionales File-Locking und Caching; ohne Redis begegnest du irgendwann den Fehlern „Datei ist gesperrt“ bei gleichzeitiger Synchronisation. Es kostet ein paar Megabyte RAM.

Is a managed Nextcloud different from self-hosting?Unterscheidet sich ein gemanagtes Nextcloud vom Self-Hosting?

Functionally it is the same application. The difference is who holds the root shell: with a managed container you get the app, a hostname and a certificate, and you do not get to install PHP extensions or run occ yourself. If you need that control, put it on a VPS instead.Funktional ist es dieselbe Anwendung. Der Unterschied ist, wer die Root-Shell hat: Bei einem gemanagten Container bekommst du die App, einen Hostnamen und ein Zertifikat, darfst aber keine PHP-Erweiterungen installieren oder selbst occ ausführen. Brauchst du diese Kontrolle, gehört es stattdessen auf einen VPS.

Ready to order?Bereit zu bestellen?

Prices are final totals; no VAT is shown (§19 UStG). Need something the shop does not list? Email us for a written offer.Alle Preise sind Endpreise ohne ausgewiesene USt. (§19 UStG). Du brauchst etwas, das nicht im Shop steht? Schreib uns für ein schriftliches Angebot.

Order now →Jetzt bestellen → Request a custom configIndividuelle Konfiguration anfragen