How to Install Nextcloud with Nginx on Ubuntu 24.04

Cloud storage has become a crucial need for many people. Services like Dropbox and Google Drive offer the convenience of accessing files from anywhere, but privacy and data control are often major concerns. Nextcloud provides an open-source solution that allows us to build our own cloud storage, giving us full control over our data and ensuring privacy. Additionally, Nextcloud offers various extra features through apps that can be installed as needed. In this tutorial, we will learn how to install Nextcloud with Nginx on Ubuntu 24.04.

Tutorial Environment

In this tutorial, we will use:

  • VPS: Vultr 1 CPU 1 GB RAM
  • OS: Ubuntu 24.04
  • Web server: Nginx
  • PHP: PHP v8.3
  • Database: MariaDB v10.11
  • Subdomain: nextcloud.aminlabs.my.id
  • SSL: Let’s Encrypt
  • Nextcloud: Nextcloud v29

Notes:

  • For Nextcloud system requirements, refer to docs.nextcloud.com
  • Sign up here to get $100 free credit from Vultr.

Install Nextcloud

The steps to install Nextcloud are divided into 6 stages: installing the MariaDB database, installing PHP, installing Nginx, installing SSL, and installing Nextcloud.

1. Install MariaDB

Update and upgrade the Ubuntu system:

Install the MariaDB database:

Log in to MariaDB:

Create a database for Nextcloud:

2. Install PHP

Install PHP and the extensions required by Nextcloud:

Open the php.ini configuration file:

Change the memory_limit value to 512M:

Restart the PHP-FPM server:

3. Install Nginx

Install the Nginx web server:

Create an Nginx server block configuration file for the subdomain nextcloud.aminlabs.my.id:

Add the configuration:

Enable the Nginx server block configuration:

Restart the Nginx service:

Open ports 80 and 443 if UFW firewall is active:

4. Install SSL

Install Certbot for Nginx:

Request SSL for the subdomain nextcloud.aminlabs.my.id:

5. Configure Nginx for Nextcloud

Open the previously created Nginx server block configuration file:

Modify the configuration content for reverse proxy to PHP-FPM and specific configurations for Nextcloud:

For a complete explanation of the above configuration, refer to docs.nextcloud.com.

Restart the Nginx service:

6. Nextcloud Web Installer

Download the latest Nextcloud web installer:

Install unzip if not already available:

Extract nextcloud.zip to the document root directory, as configured in Nginx:

Create a nextcloud-data directory for storing Nextcloud data:

Change the ownership of the directory to the www-data user:

Browse to https://nextcloud.aminlabs.my.id. If all previous configurations are correct, you should see the page as shown in the image below:

Nextcloud installation
Nextcloud installation

Enter the required information:

  • Login: Username for the Nextcloud admin account
  • Password: Password for the Nextcloud admin account
  • Data folder: Data directory location, /var/www/nextcloud.aminlabs.my.id/nextcloud-data
  • Database account: Database username, nextcloud
  • Database password: Database password, rahasia
  • Database name: Database name, nextcloud

Then click the Install button.

If the installation is completed successfully, you should see a result like the image below:

Nextcloud recommended apps
Nextcloud recommended apps

Click Skip to be redirected to the Dashboard.

At this point, the installation steps for Nextcloud are complete. For administration and usage instructions for Nextcloud, please follow the official guide:

If you found this article helpful and would like to support my work, consider making a donation through PayPal. Your support helps me continue creating useful content and tutorials. Thank you!

Donate via PayPal: https://paypal.me/musaamin

Leave a Reply

Your email address will not be published. Required fields are marked *