What You Need
- A VPS with at least 2 GB RAM (4 GB is comfortable once you add the calendar, contacts and preview generation)
- Ubuntu 22.04 or 24.04 with SSH access
- A domain or subdomain pointed at the server's IP
Storage is the real sizing question, not CPU. Nextcloud itself is light; your files are what grow. Pick a plan by how much you plan to store, and remember you can resize later.
Step 1: Install Docker
curl -fsSL https://get.docker.com | shStep 2: The Compose File
This runs Nextcloud with a Postgres database and Caddy for automatic HTTPS — no manual certificate wrangling. Save it as docker-compose.yml:
services:
db:
image: postgres:16-alpine
restart: always
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: change-this-password
volumes:
- db:/var/lib/postgresql/data
app:
image: nextcloud:apache
restart: always
environment:
POSTGRES_HOST: db
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: change-this-password
NEXTCLOUD_TRUSTED_DOMAINS: cloud.example.com
volumes:
- nextcloud:/var/www/html
depends_on:
- db
caddy:
image: caddy:2-alpine
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
depends_on:
- app
volumes:
db:
nextcloud:
caddy_data:Step 3: The Caddyfile
Caddy fetches and renews a Let's Encrypt certificate for you. Create Caddyfile next to the compose file:
cloud.example.com {
reverse_proxy app:80
}Replace cloud.example.com with your real domain (in both files), then bring it up:
docker compose up -dOpen https://cloud.example.com and create your admin account. The certificate is issued automatically on first request.
Step 4: Lock It Down
Two settings that matter on a public server:
- In Settings → Administration → Security, confirm you are served over HTTPS only.
- Do not expose the Postgres port. In the compose above it is only reachable inside the Docker network, which is correct — never add a
ports:entry to thedbservice.
Step 5: Back It Up
Your data lives in two Docker volumes. A nightly backup to off-site storage is a one-liner with rclone (configure a remote first with rclone config):
docker compose exec -T db pg_dump -U nextcloud nextcloud | gzip > /root/nc-db.sql.gz
docker run --rm -v nextcloud:/data -v /root:/backup alpine tar czf /backup/nc-files.tar.gz -C /data .
rclone copy /root/nc-db.sql.gz remote:nextcloud-backups
rclone copy /root/nc-files.tar.gz remote:nextcloud-backupsDrop that in a cron job and you have real disaster recovery — something the big providers never actually give you.
What It Costs
A personal Nextcloud runs fine on a small VPS; the variable is storage. On NoctHost you pay hourly from a prepaid balance, so a media-heavy instance and a light one cost exactly what they use, and you can top up with crypto without a card on file. For a household drive plus calendar and contacts, the Standard plan (2 vCPU, 4 GB) is the sweet spot.