Nextcloud is the big one: files with desktop and phone sync, calendars, contacts, photo upload and, optionally, a whole office suite. It's a self-hosted Google Drive. It's also the most complex app on this site, which is why I only recommend installing it one way: Nextcloud All-in-One (AIO), the official method where a single "master container" sets up and maintains everything else for you.
Prerequisites
- Nginx Proxy Manager running from
/opt/npm(it owns ports 80 and 443, so AIO runs in "reverse proxy mode") - A subdomain such as
cloud.example.comwith an A record pointing at your server - At least 2 GB of RAM (4 GB if you want the extras) and room for your files
1. Write the Compose file
sudo mkdir -p /opt/nextcloud-aio
cd /opt/nextcloud-aio
sudo nano compose.yml
services:
nextcloud-aio-mastercontainer:
image: ghcr.io/nextcloud-releases/all-in-one:latest
init: true
restart: always
container_name: nextcloud-aio-mastercontainer # AIO requires this exact name
volumes:
- nextcloud_aio_mastercontainer:/mnt/docker-aio-config # and this exact volume name
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- "127.0.0.1:8080:8080" # AIO's setup page, localhost only
environment:
APACHE_PORT: 11000 # reverse proxy mode
APACHE_IP_BINDING: 127.0.0.1 # don't publish Nextcloud itself on the internet
APACHE_ADDITIONAL_NETWORK: npm_default # let NPM reach it by name
SKIP_DOMAIN_VALIDATION: "false"
volumes:
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer
Why the Docker socket? The master container creates and updates Nextcloud's other containers (database, Redis, web server, optional extras) itself. That's what makes AIO easy, and it's also why you should only give socket access to software you trust. AIO is maintained by the Nextcloud project.
2. Start the master container
sudo docker compose up -d
On your own computer, tunnel to the setup page:
ssh -L 8080:localhost:8080 your-user@your-server-ip
# then open https://localhost:8080 (accept the self-signed certificate warning)
AIO shows a passphrase. Save it in your password manager now. It's the only way back into this setup page later.
3. Add the proxy host before entering the domain
AIO checks your domain before it starts anything, so set up NPM first. In NPM: Hosts → Proxy Hosts → Add:
- Domain:
cloud.example.com - Forward:
http·nextcloud-aio-apache· port11000 - Turn on Websockets Support
- SSL tab: request a certificate, enable Force SSL
- Advanced tab: paste the two lines AIO's documentation recommends for NPM:
client_max_body_size 0; # no upload size limit
proxy_read_timeout 3610s; # let Nextcloud time out before the proxy does
Don't worry that the proxy host shows an error for a minute. nextcloud-aio-apache doesn't exist until the next step creates it.
4. Enter your domain and start the containers
Back on the AIO page, enter cloud.example.com and submit. Then pick your optional containers. My advice for a first install is to leave most of them off: you can add Collabora (office), Talk or full-text search later, once you know how much RAM you have to spare. Choose your timezone and click Download and start containers.
The first start takes a few minutes. When it finishes, AIO shows the initial admin username and password. Log in at https://cloud.example.com and change the password right away.
5. Turn on the built-in backups
This is AIO's best feature. In the AIO page's backup section, enter a backup location on the server (for example /mnt/backup/nextcloud, or a mounted second disk) and create the first backup. AIO uses BorgBackup: incremental, compressed and encrypted. It then shows a backup password. Save that one too.
After the first backup succeeds, enable daily backups. AIO then also updates Nextcloud and its containers automatically after each nightly backup, which makes it unusually low-maintenance.
The backup still lives on the same server. Copy the Borg backup folder off-site as well. My Google Drive backup setup works for this, and Borg's own encryption means the files are already unreadable to anyone without your backup password.
6. Connect your devices
Install the Nextcloud desktop client (Windows, macOS, Linux) and the mobile app, sign in with your server URL, and pick the folders to sync. Start with one folder and confirm it works before pointing it at everything.
Troubleshooting
- "Domain does not point to this server": the NPM proxy host is missing or wrong, or DNS hasn't propagated. Check
dig +short cloud.example.com, then the proxy host's forward target. - Containers fail to start with a network error:
npm_defaultmust exist before AIO starts. Make sure NPM is running (sudo docker network ls). - Uploads fail on big files: the
client_max_body_size 0;line is missing from the NPM Advanced tab. - Server is slow or swapping: turn off optional containers you don't use in the AIO page. Collabora and full-text search are the heaviest.
Official documentation: Nextcloud docs · Repository: nextcloud/all-in-one