Planning Your Homelab listed password managers, photo backup, and file sync among the most common things people stop paying for once they have a homelab. Vaultwarden and Immich covered the first two - Nextcloud is the answer to the third: a Dropbox or Google Drive replacement that syncs regular files (not just photos) across your devices, backed by your own storage instead of a subscription.

What Nextcloud actually is

Nextcloud is a self-hosted file sync and collaboration platform: desktop clients for Windows/Mac/Linux and mobile apps for iOS/Android keep a folder in sync with the server, a web UI lets you browse and share files from anywhere on your network, and optional built-in apps add calendar (CalDAV) and contacts (CardDAV) sync on top - useful if you'd rather not depend on a third-party account for those either. It's a considerably bigger piece of software than anything else in this tier (it's a full PHP web application with a database behind it, not a single lightweight container), which is the trade-off for being general-purpose rather than single-purpose the way Immich or Vaultwarden are.

Running it

services:
  nextcloud-db:
    image: mariadb:11
    container_name: nextcloud-db
    environment:
      - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
      - MARIADB_DATABASE=nextcloud
      - MARIADB_USER=nextcloud
      - MARIADB_PASSWORD=${DB_PASSWORD}
    volumes:
      - ./db:/var/lib/mysql
    restart: unless-stopped

  nextcloud:
    image: nextcloud:apache
    container_name: nextcloud
    ports:
      - "8083:80"
    environment:
      - MYSQL_HOST=nextcloud-db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=${DB_PASSWORD}
    volumes:
      - ./html:/var/www/html
      - ./data:/var/www/html/data
    depends_on:
      - nextcloud-db
    restart: unless-stopped
  • The nextcloud:apache image bundles its own web server, so there's no separate reverse proxy needed to get it running locally - just the one container plus its database.
  • First run walks you through an admin account and the database connection details above in a setup wizard at http://server-ip:8083.

Resource expectations: noticeably heavier at idle than Vaultwarden or a single Immich container - budget at least 1GB RAM for the app container plus the database, and expect the first sync of a large existing file collection to be genuinely CPU- and disk-I/O-intensive for a while (thumbnail generation, file indexing). Comfortable on a typical mini PC once past that initial sync.

HTTPS is strongly pushed, though not hard-required like Vaultwarden

Nextcloud's desktop and mobile sync clients push you toward HTTPS, but unlike Vaultwarden it isn't a hard requirement: the desktop client warns on a plain HTTP connection and makes you click through an "unencrypted connection" prompt rather than refusing outright. (Vaultwarden is stricter because its web vault does its encryption in the browser, which only works in a secure context.) If the server sends an HSTS header, though, the client will enforce HTTPS the same way. (This is based on recent client versions and community reports rather than Nextcloud's official docs, so if you hit different behavior, that's why - test against your own client version rather than taking this as gospel.)

Nextcloud's own web UI works fine over plain HTTP on your LAN in the meantime. When you want sync clients on a proper encrypted connection, the fix is the same as for Vaultwarden (see its TLS section): jump ahead to Reverse Proxy and TLS in Intermediate.

Don't over-scope it on day one

Nextcloud's app store adds a large amount beyond file sync - office document editing, a Kanban board, a mail client, dozens more. Resist installing more than calendar/contacts to start: each additional app is more surface area to keep updated and more that can break during a Nextcloud version upgrade, for value you may not actually need. Add apps as a specific need comes up, not because they're one click away.

Backing it up

Two things matter, same shape as Immich:

  • The database - shares, permissions, calendar/contacts data, and file metadata. Without it, the files in ./data are just an unsorted pile with no record of who they belonged to or were shared with.
  • The ./data folder - the actual file contents. Treat this the same way the Immich page treats its photo library: if what you're syncing is genuinely irreplaceable (not just a convenient copy of files that exist elsewhere too), it belongs in your highest-priority backup scope, not an afterthought.

Nextcloud also has a built-in maintenance mode worth putting a backup script around - switch it on, dump the database (see Backups 101), run the backup, then switch it off again. occ is Nextcloud's admin tool and lives inside the container, so run it through docker exec as the web server user:

docker exec -u www-data nextcloud php occ maintenance:mode --on
docker exec nextcloud-db sh -c 'mariadb-dump -u root -p"$MARIADB_ROOT_PASSWORD" nextcloud' > ./db-dumps/nextcloud.sql
# ...run your backup here...
docker exec -u www-data nextcloud php occ maintenance:mode --off

Next: Networking Basics.