Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

How to Self-Host Nextcloud on a VPS (Complete Guide)

A complete step-by-step guide to self-hosting Nextcloud on a VPS in 2026, covering installation, configuration, security, and the specs you need.

How to Self-Host Nextcloud on a VPS (Complete Guide)

Nextcloud is a powerful open-source application that enables users to create their own cloud storage solution. In this guide, you will learn how to self-host Nextcloud on a VPS. Youโ€™ll get insights into installation techniques, utilizing Docker, and best practices for performance and security.

Why Self-Host Nextcloud?

Self-hosting provides you with more control over your data, offers better privacy, and usually saves costs in the long run compared to cloud storage solutions. Moreover, you have the power to customize your Nextcloud instance to suit your needs, whether for personal use or team collaboration.

Selecting a VPS Provider

Choosing the right VPS provider is critical for your Nextcloud installation. Below is a comparison table of top VPS providers that suit various budgets and needs:

ProviderMonthly PriceStorage TypeRAMCPU
Contabo VPS5.99 EURSSD4 GB2 vCPU
Hetzner Cloud4.15 EURSSD2 GB1 vCPU
DigitalOcean6 USDSSD2 GB1 vCPU
Vultr6 USDSSD2 GB1 vCPU
Linode (Akamai Cloud)5 USDSSD2 GB1 vCPU

For further details about different providers, refer to our full VPS comparison.

Prerequisites

Before starting your Nextcloud installation, ensure your environment meets the following prerequisites:

  1. VPS: A VPS with at least 2 GB of RAM. Contabo, Hetzner, or DigitalOcean are popular choices.
  2. Domain Name: An optional but recommended domain to access your Nextcloud instance.
  3. Operating System: Ubuntu 20.04 or later.
  4. Basic CLI Knowledge: Familiarity with Linux Command Line Interface.

Step 1: Initial Setup

  1. Access Your VPS: Log in to your VPS using SSH.

    ssh root@your_vps_ip
  2. Update Packages: Ensure your system is up to date.

    apt update && apt upgrade -y
  3. Install Required Dependencies:

    apt install software-properties-common -y
    apt install apache2 mysql-server php libapache2-mod-php php-mysql php-xml php-zip php-gd php-curl php-json php-mbstring -y

Step 2: Install Nextcloud

  1. Download Nextcloud:

    wget https://download.nextcloud.com/server/releases/nextcloud-23.0.0.zip
  2. Unzip the Archive:

    apt install unzip -y
    unzip nextcloud-23.0.0.zip
  3. Move to Web Directory:

    mv nextcloud /var/www/html/
  4. Set Permissions:

    chown -R www-data:www-data /var/www/html/nextcloud

Step 3: Configure Database

  1. Log into MySQL:

    mysql -u root -p
  2. Create Nextcloud Database and User:

    CREATE DATABASE nextcloud;
    CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'yourpassword';
    GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

Step 4: Configure Apache

  1. Set up an Apache Configuration:

    nano /etc/apache2/sites-available/nextcloud.conf

    Add the following configuration:

    <VirtualHost *:80>
        DocumentRoot /var/www/html/nextcloud
        ServerName your_domain_or_ip
    
        <Directory /var/www/html/nextcloud>
            Options +FollowSymlinks
            AllowOverride All
            Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
        CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
    </VirtualHost>
  2. Enable Configuration:

    a2ensite nextcloud.conf
    a2enmod rewrite
    systemctl restart apache2

Step 5: Finish Installation via Web Interface

Navigate to http://your_domain_or_ip and follow the on-screen instructions to complete the Nextcloud setup. Enter the database details you configured earlier.

Optional: Running Nextcloud with Docker

If you prefer Docker, you can deploy Nextcloud with Docker in a few steps:

  1. Install Docker:

    apt install docker.io -y
    systemctl start docker
    systemctl enable docker
  2. Run Nextcloud Docker Container:

    docker run -d -p 8080:80 -v nextcloud_data:/var/www/html --name nextcloud --restart always nextcloud

Access your Nextcloud instance at http://your_vps_ip:8080.

FAQs

1. What are the advantages of self-hosting Nextcloud?

Self-hosting Nextcloud gives you complete control over your data, enabling enhanced privacy and security. You can manage your files, adjust configurations as per your needs, and customize your software without the constraints typical with commercial services. Moreover, it can often be more cost-effective in the long term, especially for teams.

2. What VPS provider should I choose for Nextcloud?

Choosing a VPS provider depends on your specific requirements (performance, budget, and location). If you seek a balance between cost and performance, Contabo and Hetzner are solid choices given their affordable plans and decent resources. For users looking for a minimal entry cost, Hetznerโ€™s services start as low as 4.15 EUR per month.

3. Can I scale my Nextcloud setup?

Yes, Nextcloud can scale effectively. If your usage grows and you need more storage or resources, most VPS providers like DigitalOcean and Linode allow you to upgrade your plan seamlessly. Additionally, Nextcloud can be set up in a clustered environment if enterprise-level scaling is needed.

By following this guide, you should now have a fully functional Nextcloud setup on your VPS, allowing for seamless access to your files wherever you are. For further learning, explore resources from r/selfhosted or consider contributing to the awesome-selfhosted repository.