How To Set up and Configure Nextcloud with Apache on Ubuntu 18.04

Nextcloud is an open supply, self-hosted file share and collaboration platform, much like Dropbox. It comes bundled with media participant, calendar and get in touch with administration.

Nextcloud is extensible through apps and has desktop and cell purchasers for all main platforms.

On this tutorial we’ll present you tips on how to set up and configure Nextcloud with Apache on an Ubuntu 18.04 machine.


Earlier than beginning with the tutorial, be sure to are logged in as a consumer with sudo privileges.

Step 1: Creating MySQL Database

NextCloud can use SQLite, PostgreSQL or MySQL database to retailer all its information. On this tutorial we are going to use MySQL because the database of selection.

If you happen to don’t have MySQL or MariaDB put in in your Ubuntu server you’ll be able to set up by following one of many directions under:

To create a database and consumer, first login to the MySQL shell by typing the next command:

Run the next SQL statements to create a database named nextcloud, consumer named nextclouduser and to grant all mandatory permissions to the consumer:

CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL ON nextcloud.* TO ‘nextclouduser’@’localhost’ IDENTIFIED BY ‘change-with-strong-password’;

Step 2: Putting in PHP and Apache

Nextcloud is a PHP utility. PHP 7.2 which is the default PHP model in Ubuntu 18.04 is absolutely supported and advisable for Nextcloud.

Run the next command to put in Apache, PHP and all required PHP extensions and :

sudo apt set up apache2 php7.2 php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring php7.2-intl php7.2-imagick php7.2-xml php7.2-zip libapache2-mod-php7.2

Step 3: Configuring firewall

Assuming you’re utilizing UFW to handle your firewall, you’ll have to open HTTP (80) and HTTPS (443) ports. You are able to do that by enabling the ‘Apache Full’ profile which incorporates guidelines for each ports:

sudo ufw enable ‘Apache Full’

Step 4: Downloading Nextcloud

On the time of writing this text, the most recent steady model of Nextcloud is model 15.0.0. Earlier than persevering with with the subsequent step go to the Nextcloud obtain web page and verify if there’s a new model of Nextcloud accessible.

Begin by obtain the most recent model of Nextcloud utilizing the next wget command:

wget -P /tmp

As soon as the obtain is full, extract the archive to the /var/www listing:

sudo unzip /tmp/ -d /var/www

Set the right possession in order that the Apache internet server can have full entry to the Nextcloud’s information and directories.

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

Step 5: Configure Apache

Open your textual content editor and create the next Apache configuration file.

sudo nano /and so on/apache2/conf-available/nextcloud.conf

/and so on/apache2/conf-available/nextcloud.conf

Alias /nextcloud “/var/www/nextcloud/”

<Listing /var/www/nextcloud/>
Choices +FollowSymlinks
AllowOverride All

<IfModule mod_dav.c>
Dav off

SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud


Allow the newly added configuration and all required Apache modules with:

sudo a2enconf nextcloud
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

Activate the modifications by restarting Apache service:

sudo systemctl reload apache2

Step 6: Putting in Nextcloud

Now that Nextcloud is downloaded and all mandatory companies are configured open you browser and begin the Nextcloud set up by visiting your server’s area title or IP deal with adopted by /nextcloud :


You can be offered with the Nextcloud setup web page.

Enter your required admin username and password and the MySQL consumer and database particulars you beforehand created.

Click on on the End setup button and as soon as the set up course of is accomplished you may be redirected to the Nextcloud dashboard logged in as admin consumer.


You may have discovered tips on how to set up and configure Nextcloud in your Ubuntu 18.04 machine. When you have a site title related together with your Nextcloud server, you’ll be able to comply with this information and safe your Apache with Let’s Encrypt.

To search out extra details about tips on how to handle your Nextcloud occasion go to the Nextcloud documentation web page.

When you have any query, please depart a remark under.


Germany Devoted Server

Leave a Reply