🛠️ Tutorials · 11 min read

Hosting Nextcloud on a VPS in 2026: Complete Guide (Docker, HTTPS, Performance, Backups)

Comprehensive 2026 technical guide for deploying Nextcloud on a VPS using Docker. Covers server sizing, PostgreSQL and Redis optimization, HTTPS configuration, and reliable backup strategies.

S By Selfhostr Team · independent tests
ⓘ This article may contain affiliate links (no extra cost to you, it supports our tests). See the disclosure.

Self-hosting collaborative solutions has reached a level of technical maturity in 2026 that makes deploying Nextcloud not only viable but often superior to mainstream SaaS offerings in terms of control, privacy, and long-term cost. However, the difference between a smooth instance and a latency nightmare lies almost exclusively in the rigor of the underlying infrastructure.

Hosting your own private cloud solution requires a robust and well-configured VPS. Contrary to popular belief, the apparent simplicity of installation does not exempt you from a deep understanding of system resources. In this guide, we will deconstruct the technical architecture required to run Nextcloud in production, focusing on the modern approach via Docker Compose and Nextcloud AIO (All-in-One), while addressing critical aspects of security, performance, and data resilience.

Why choose a VPS over a Raspberry Pi in 2026?

Before diving into the configuration, it is imperative to clarify the hosting choice. For light personal use, a Raspberry Pi 5 remains an attractive option. But as soon as we talk about “reliable production,” multiple simultaneous users, or syncing large file volumes, the VPS is the clear choice for architectural and hardware reasons.

  1. IOPS and NVMe Storage: Nextcloud is an I/O-intensive application. Every action (opening a folder, indexing, syncing) generates thousands of reads/writes to the database and file system. Modern VPSs use NVMe drives with guaranteed IOPS (often > 10,000 IOPS for mid-range VPSs), whereas a USB SSD or even a micro-SD card on a Pi plateaus quickly, creating visible bottlenecks during synchronization.
  2. Connection Stability and Fixed IP: A VPS offers dedicated symmetric bandwidth and a fixed IP address, essential for stable DNS routing and secure incoming connections. Home connections often have dynamic IPs and variable latency, which affects the responsiveness of the Nextcloud application, especially via WebDAV clients.
  3. Isolation and Security: A VPS is an isolated environment. In the event of a service compromise, the impact is contained. On a home server, a breach could expose your entire local network. Additionally, VPS providers offer basic DDoS protection and disk snapshots, two critical elements for disaster recovery.
  4. Maintenance and Updates: VPSs allow scheduled reboots without service interruption for the end-user (using clusters or failovers, even simple ones). Managing OS and hardware updates on a Pi at home requires physical intervention or complex remote reboot scripts.

In summary, if you are a single user with less than 5 GB of data, the Pi will do. For professional, shared family, or team use, the VPS is the minimum investment required for reliability.

VPS Sizing: The Numbers That Matter

Over-provisioning is expensive; under-provisioning kills the user experience. Here are recommendations based on real-world workloads observed in 2026 with Nextcloud AIO.

User ProfileActive UsersPlanned StorageVPS RAMCPU (vCores)Storage TypeEst. Monthly Cost
Solo / Small Family1-3< 500 GB2 GB - 4 GB1 - 2 vCoresStandard SSD€5 - €10
SME Team / Heavy Use5-201 - 5 TB4 GB - 8 GB2 - 4 vCoresPremium NVMe€15 - €30
Organization / Heavy Collab.20+> 5 TB8 GB - 16 GB+4+ vCoresHigh-Perf NVMe€40+

Technical Considerations:

Installation via Docker Compose and Nextcloud AIO

Forget manual installations with LAMP/LEMP. In 2026, the reference method for a fast, secure, and maintainable deployment is Nextcloud AIO (All-in-One). This project encapsulates the entire Nextcloud ecosystem (web server, database, cache, auxiliary services) into a set of orchestrated Docker containers.

System Prerequisites

  1. A VPS running Ubuntu 24.04 LTS or Debian 12 (Stable).
  2. root access or a user with sudo privileges.
  3. A domain name pointing to your VPS IP (e.g., cloud.yourdomain.com).
  4. Docker and Docker Compose installed.

Step 1: Installing Docker

Connect to your VPS via SSH and install the dependencies:

sudo apt update
sudo apt install -y ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Step 2: Deploying Nextcloud AIO

Nextcloud AIO simplifies orchestration. You just need to launch a single container that will download and configure the others.

docker run -d \
  --name nextcloud-aio-metacontainer \
  --restart always \
  -p 8080:8080 \
  -v nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  nextcloud/all-in-one:latest

Once the container is started, wait a few minutes. Access http://VPS_IP:8080 in your browser. You will see the Nextcloud AIO management interface.

Initial Configuration:

  1. Admin Password: Set a strong password for the Nextcloud administration interface.
  2. Web Port: By default, AIO uses port 8080 for unencrypted incoming traffic (for initial configuration), but it handles the reverse proxy and SSL automatically.
  3. Storage: AIO will detect the default volume. For better management, it is recommended to mount a named Docker volume or bind-mount to a dedicated directory on the VPS NVMe disk, for example /var/lib/nextcloud/data.

Step 3: Accessing the Interface

After configuration, the main interface will be accessible on the defined port (usually port 443 if HTTPS is configured, or a custom port). The AIO interface allows you to manage resources allocated to containers, enable/disable apps (Talk, Mail, Office), and view logs.

HTTPS Configuration and Security

Security is not optional. Nextcloud AIO natively integrates Let’s Encrypt for SSL/TLS certificate management. This is the industry standard in 2026 for end-to-end encryption.

Activating SSL

In the Nextcloud AIO administration interface (accessible via the configured port, often 8080 initially, then redirected):

  1. Go to the Settings or Security tab.
  2. Enter your full domain name (e.g., cloud.example.com).
  3. Enable the Enable SSL option.
  4. AIO will contact Let’s Encrypt to validate domain ownership via the ACME protocol (usually via HTTP-01 challenge). Ensure port 80 is open on your firewall for this initial validation.

Once the certificate is generated, AIO automatically configures the internal Nginx reverse proxy to redirect all HTTP traffic to HTTPS and apply modern security headers:

Firewall and Hardening

Even with AIO, the VPS must be protected at the network level. Use ufw (Uncomplicated Firewall):

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 80/tcp   # Only necessary for initial Let's Encrypt validation
sudo ufw allow 443/tcp  # HTTPS
sudo ufw enable

If you use an external reverse proxy service (like Cloudflare), ensure that only port 443 is accessible from the public internet, and that internal HTTP traffic to AIO remains blocked or restricted to the local IP.

Performance Optimization: PHP, Redis, and PostgreSQL

Nextcloud is a PHP application. By default, performance can be limited if parameters are not adjusted for production. Nextcloud AIO exposes configuration files in the nextcloud-aio-nextcloud container.

1. Database: PostgreSQL vs MySQL

Nextcloud AIO offers the choice. In 2026, PostgreSQL is recommended for complex workloads and large databases, thanks to its superior handling of concurrent transactions and complex data types. MySQL/MariaDB remains performant for simple workloads.

If you choose PostgreSQL, ensure you check the shared_buffers and work_mem parameters in the database container. AIO sets these by default, but for a VPS with 4GB+ of RAM, increase shared_buffers to 25% of the total RAM allocated to the DB container.

2. Cache: Redis is Mandatory

Redis cache is mandatory for good performance. It stores sessions, file locks, and frequent query results.

In Nextcloud AIO, Redis is enabled by default. Verify that the Redis container is running and accessible. In Nextcloud settings (Administration > Settings > Basic settings), ensure that:

If you see warnings in the Nextcloud diagnostic page regarding “No memory cache has been configured,” it means Redis is not correctly linked. Restart the containers via the AIO interface to reapply environment variables.

3. PHP-FPM Tuning

The Nextcloud PHP container uses FPM. Default limits are often conservative. To improve response times for heavy scripts (such as indexing scripts or massive uploads), adjust PHP limits in the Nextcloud container configuration file (accessible via logs or by running docker exec -it nextcloud-aio-nextcloud php-fpm-config if you access the shell, or via environment variables in AIO).

Key parameters to adjust in php.ini:

Nextcloud AIO allows you to set these variables via mounted configuration files or environment variables in the management interface. Consult the official AIO documentation for the exact method of persisting these configs during updates.

4. Background Jobs

Never let Nextcloud use “AJAX” for background jobs in production. Configure Cron via the Docker container.

In the AIO interface, ensure that the nextcloud-aio-nextcloud container is configured to run the cron.php script every 5 minutes. You can verify this by checking the container logs or running:

docker exec -it nextcloud-aio-nextcloud crontab -l

You should see a line: */5 * * * * /usr/bin/php -f /var/www/html/cron.php.

Backups and Restoration: The 3-2-1 Rule

Having a performant server is useless if you lose your data. The backup strategy must be automated and tested.

What to Back Up

  1. Database: Metadata (files, users, permissions, tags).
  2. User Data: The Nextcloud /data directory.
  3. Configuration: Docker, Nginx, and SSL certificate configuration files.

Automation with Nextcloud AIO

Nextcloud AIO includes built-in backup tools. In the administration interface:

  1. Go to the Backup tab.
  2. Configure a backup destination:
    • Local: Another disk on the VPS (risky if the disk fails).
    • S3 Compatible: The recommended choice. Use an S3 bucket from another provider (AWS, Backblaze B2, OVH) or a local S3 server on your network (if you have a home infra).
    • WebDAV: To another Nextcloud service.

Enable weekly full backups and daily incremental backups. AIO uses borgbackup or restic internally to create deduplicated and encrypted archives.

Restoration Test

An untested backup is a fictitious backup. Every 3 months:

  1. Create a test VPS or an isolated Docker container.
  2. Install Nextcloud AIO.
  3. Restore the latest backup.
  4. Verify that users can log in and files are intact.

Recovery After Major Incident

If your VPS is lost:

  1. Provision a new VPS with the same OS version and Docker.
  2. Install Nextcloud AIO.
  3. Launch the restoration procedure pointing to the S3 bucket.
  4. AIO will restore the database and data in the correct order.
  5. Reapply your custom configurations (PHP, Nginx) if they were not backed up by AIO (they are usually stored in the nextcloud_aio_mastercontainer volume).

Which Choice for Your Profile?

The “Technical Independent” Profile

The “Professional / SME” Profile

The “Informed Consumer” Profile

FAQ

Q: Can I migrate an existing Nextcloud installation to Docker AIO?

A: Yes, but it is delicate. The recommended method is to export user data and the database from the old instance, then import into AIO. AIO provides an import tool, but you must ensure that file permissions (www-data vs nextcloud in Docker) are correct. Always test in a staging environment before taking the main service offline.

Q: Is Nextcloud AIO safe for production?

A: Yes, if you follow security best practices (HTTPS, firewall, strong passwords). AIO isolates services in containers, which limits the impact of a vulnerability. However, like any software, it may contain bugs. Stay up to date by using the stable versions offered by AIO and enable security notifications.

Q: How do I manage Nextcloud AIO updates?

A: The AIO administration interface offers a one-click update. It stops the containers, downloads the new images, and restarts the system. Data and configuration are preserved because they are stored in persistent Docker volumes. It is advisable to perform a backup before any major update.

Q: Can I use Nextcloud without Docker?

A: Absolutely. Nextcloud works perfectly in “Bare Metal” mode (PHP, Apache/Nginx, MySQL/PostgreSQL). It is often lighter on RAM resources. However, Docker AIO offers unparalleled deployment and maintenance simplicity, especially for auxiliary services like Collabora or OnlyOffice. For a VPS dedicated to Nextcloud, AIO is the most pragmatic choice in 2026.

Tags: NextcloudVPSDockerPostgreSQLRedisHTTPSBackup

Related

🛠️ Tutorials

Self-Hosting Your Website in 2026: Complete Guide (VPS, Docker, HTTPS)

2026 technical guide to self-hosting on a VPS: choosing plans, Docker setup, Let's Encrypt HTTPS, security, and real costs. Compare self-hosting vs. cloud.

Read
🛠️ Tutorials

Hosting a Discord Bot 24/7 on a VPS in 2026: Complete Guide (Node/Python, systemd, Docker)

2026 technical guide for hosting a Discord bot continuously on a VPS. Compare Node vs Python, systemd vs Docker, sizing, costs, and token security for developers.

Read
🛠️ Tutorials

Hosting n8n on a VPS in 2026: Complete Self-Hosted Guide (Docker, HTTPS, Backups)

2026 technical guide to self-hosting n8n on a VPS using Docker Compose, HTTPS, and security best practices. Compare cloud vs on-premise costs to automate workflows without subscriptions.

Read