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

guide

How to Self-Host Nextcloud on Hetzner (2026 Guide)

Learn how to self-host Nextcloud on Hetzner with a detailed 2026 guide covering setup, configuration, and the recommended specs for a smooth deployment.

How to Self-Host Nextcloud on Hetzner (2026 Guide)

Nextcloud is an open-source file hosting solution that allows users to set up their own private cloud storage. Hosting it on a VPS can give you greater control and customization options. In this guide, weโ€™ll walk through the steps to install Nextcloud on a Hetzner VPS, including configuration and optimization.

Why Choose Hetzner for Hosting Nextcloud?

Hetzner is a reliable VPS provider known for their cost-effective plans and robust infrastructure. Starting at just 4.15 EUR/month, they offer a range of options that make them particularly attractive for developers and homelabbers. Below is a comparison of various VPS providers to help you understand the market.

ProviderStarting PriceFeatures
Contabo VPS5.99 EUR/moSSD storage, ample RAM
Hetzner Cloud4.15 EUR/moHigh performance, flexibility
DigitalOcean6 USD/moUser-friendly interface
Vultr6 USD/moGlobal data centers
Linode (Akamai)5 USD/moFast networking solutions

Steps to Install Nextcloud on Hetzner VPS

Step 1: Create a Hetzner VPS Instance

  1. Sign Up: Create an account on Hetzner Cloud.
  2. Select a Server: Choose a server configuration that meets your needs. For basic Nextcloud usage, a VPS with 2 GB of RAM and 1 CPU core is usually sufficient.
  3. Location: Select a data center close to your target users.
  4. Create the Server: Click on โ€œCreate Serverโ€ to start provisioning your VPS.

Step 2: Access Your VPS

Once your server is up and running, access it via SSH. Use the following command, replacing YOUR_IP_ADDRESS with your serverโ€™s public IP:

ssh root@YOUR_IP_ADDRESS

Step 3: Update System Packages

Before installing anything, ensure that your system is up to date:

apt update && apt upgrade -y

Step 4: Install Required Software

Nextcloud requires a web server, PHP, and a database server. We will use Apache, MariaDB, and PHP. Install them with these commands:

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

Step 5: Configure MariaDB

Log in to the MariaDB shell:

mysql -u root -p

Create a database for Nextcloud:

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

Replace strong_password with a secure password of your choice.

Step 6: Download and Configure Nextcloud

Download the latest version of Nextcloud:

wget https://download.nextcloud.com/server/releases/nextcloud-XX.X.X.zip
unzip nextcloud-XX.X.X.zip
mv nextcloud /var/www/html/

Set the correct permissions:

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

Step 7: Configure Apache

Create a new configuration file for Nextcloud:

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 Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
</VirtualHost>

Donโ€™t forget to replace your_domain_or_IP with your actual domain name or IP address.

Enable the Nextcloud site and necessary Apache modules:

a2ensite nextcloud.conf
a2enmod rewrite headers env dir mime
systemctl restart apache2

Step 8: Complete the Installation via the Web Interface

Open your browser and navigate to http://your_domain_or_IP. You will see the Nextcloud setup wizard.

  1. Create an Admin Account: Enter your desired username and password.
  2. Database Setup: Use the credentials you set earlier for the database.
  3. Finalize Setup: Fill in all necessary information and click โ€œFinish setupโ€.

Step 9: Secure Your Nextcloud Installation

For a secure connection, itโ€™s recommended to install an SSL certificate. You can use Letโ€™s Encrypt for free SSL certificates. This can typically be done using Certbot:

apt install certbot python3-certbot-apache -y
certbot --apache

Follow the prompts to secure your Nextcloud instance.

FAQs

Q1: Can I use my own domain for Nextcloud on Hetzner?

Yes, you can use your own domain. You should set up the A record of your domain to point to your Hetzner VPS IP address. This can be done in your domain registrarโ€™s control panel. After setting this up, you can access your Nextcloud via your domain URL instead of the VPS IP address.

Q2: Is Hetzner a good option for self-hosting Nextcloud?

Absolutely. Hetzner offers highly competitive pricing, robust performance, and excellent support for developers. Their VPS options are suitable for running Nextcloud, given their SSD storage and high-speed networks. Many self-hosted setups reported positive experiences using Hetzner, making it a preferred VPS provider in the self-hosting community.

Q3: How can I back up my Nextcloud data on Hetzner?

Backing up your Nextcloud data is crucial for data loss prevention. You can create backups by regularly exporting your database and the Nextcloud data folder. Use the following commands:

mysqldump -u nc_user -p nextcloud > nextcloud_backup.sql
tar -cvf nextcloud_data_backup.tar /var/www/html/nextcloud/data

Store these backups on a separate storage service or local drive. Additionally, you might consider automated backup solutions or scripts for regular backups to simplify the process.

In conclusion, self-hosting Nextcloud on Hetzner is a straightforward process that provides you with a powerful, flexible cloud solution. For a more detailed comparison of various VPS providers, check out the full VPS comparison.