How to Self-Host Nextcloud on DigitalOcean (2026 Guide)
Nextcloud is a powerful open-source solution for file sharing, collaboration, and self-hosting. In this guide, weโll walk you through the steps to install Nextcloud on a DigitalOcean VPS, ensuring you can manage your data efficiently.
Prerequisites
Before starting, ensure you have the following:
- A DigitalOcean account (Sign up here), where you can choose a VPS starting from $6/month.
- Basic knowledge of Linux command line.
- An SSH client (like PuTTY or the built-in terminal for Linux/Mac).
- A domain name (optional, but recommended for accessing Nextcloud).
Step 1: Create a Droplet on DigitalOcean
- Log in to your DigitalOcean account and navigate to the โDropletsโ section.
- Click on the โCreate Dropletโ button.
- Choose the Ubuntu 22.04 option (LTS is recommended).
- Select a plan based on your needs. The basic Droplet at $6/month should suffice for personal use.
- Choose a data center region close to your user base.
- Set up authentication keys if possible, then click โCreate Droplet.โ
Step 2: Connect to Your Droplet
Once your Droplet is created, connect to it via SSH:
ssh root@your_droplet_ip
Replace your_droplet_ip with the IP address assigned to your Droplet.
Step 3: Update and Upgrade the System
Ensure your server is up-to-date:
sudo apt update && sudo apt upgrade -y
Step 4: Install Required Software
Nextcloud requires a web server, PHP, and a database. Install Apache, MariaDB, and PHP with the necessary extensions:
sudo apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-xml php-mbstring php-curl php-zip php-gd php-intl -y
Step 5: Configure MariaDB
Secure your MariaDB installation:
sudo mysql_secure_installation
Follow the prompts to set a root password and remove unnecessary default settings.
Next, log in to the MariaDB shell:
sudo mysql -u root -p
Create a database and user for Nextcloud:
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'securepassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace securepassword with a strong password of your choice.
Step 6: Download and Configure Nextcloud
- Download the Nextcloud latest version:
wget https://download.nextcloud.com/server/releases/nextcloud-25.0.0.zip
- Unzip the file and move it to the Apache web directory:
sudo apt install unzip
unzip nextcloud-25.0.0.zip
sudo mv nextcloud /var/www/html/
- Set the correct permissions:
sudo chown -R www-data:www-data /var/www/html/nextcloud
sudo chmod -R 755 /var/www/html/nextcloud
Step 7: Configure Apache
Create a new Apache configuration file for Nextcloud:
sudo nano /etc/apache2/sites-available/nextcloud.conf
Add the following configuration:
<VirtualHost *:80>
ServerAdmin [email protected]
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>
Replace your_domain_or_IP with your serverโs domain or IP address.
Enable the new site and required Apache modules:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers
sudo systemctl restart apache2
Step 8: Complete the Nextcloud Installation
Open your browser and navigate to http://your_domain_or_IP. You should see the Nextcloud setup page.
-
Create an admin account.
-
Enter the database details created earlier.
- Database user:
nextclouduser - Database name:
nextcloud - Database password:
securepassword
- Database user:
-
Click โFinish setup.โ
Comparison Table of VPS Providers
| Provider | Price per Month | Features |
|---|---|---|
| Contabo VPS | 5.99 EUR | High storage options |
| Hetzner Cloud | 4.15 EUR | Excellent performance |
| DigitalOcean | 6 USD | Easy setup, scalable plans |
| Vultr | 6 USD | Global data centers |
| Linode (Akamai) | 5 USD | Reliable performance |
FAQs
1. How secure is my data when self-hosting Nextcloud on DigitalOcean?
Self-hosting brings the advantage of controlling your data while maintaining privacy. However, the security of your data heavily depends on your configuration. Regularly update your server and Nextcloud instance, employ HTTPS using Letโs Encrypt, and consider setting up a firewall. Following security best practices will help safeguard your data against unauthorized access.
2. Can I back up my Nextcloud data?
Yes, backing up your Nextcloud is crucial. Use tools like rsync or tar to back up files regularly. Also, consider backing up your database using commands like mysqldump. Automating these backups can save time and ensure data safety. For detailed strategies, the r/selfhosted community can offer insights into robust backup solutions.
3. What are the alternatives to DigitalOcean for hosting Nextcloud?
Several VPS providers are suitable for hosting Nextcloud, including Hetzner, Contabo, and Vultr. Each has unique advantages. For example, Hetzner is known for its performance, while Contabo often offers larger storage solutions. Always consider pricing, features, and user reviews when choosing a provider. For a comprehensive comparison, visit our full VPS comparison.
Conclusion
By following these steps, you can successfully install and self-host Nextcloud on DigitalOcean. This opens up a world of possibilities for file sharing and collaboration in a secure environment. For ongoing maintenance, keep your system updated and explore Nextcloudโs extensive app ecosystem to enhance functionality. Happy self-hosting!