How to Install Nextcloud on Your Synology NAS

How to Install Nextcloud on Your Synology NAS

What is Nextcloud? Nextcloud is the most deployed self-hosted file share and collaboration platform on the web. Access and collaborate across your devices. The Nextcloud application is functionally similar to Dropbox or OneDrive. Unlike Dropbox and OneDrive, Nextcloud does not offer off-premises file storage hosting. Nextcloud is free and open-source, which means that anyone is allowed to install and operate it on their own private server devices. Follow the instructions below to install Nextcloud on your Synology NAS device. You can install it on your DSM version 6.2.3+.

Nextcloud guide UPDATED on 24.09.2020

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install the following packages through the DSM Package Center.

  • Web Station
  • Apache HTTP Server 2.4.43
  • PHP 7.3.16
  • phpMyAdmin 4.9.2 / Also install PHP 7.2
  • MariaDB 10.3.21

  • STEP 3

Change the default MariaDB password. Follow the instructions in the image below.

  • Open MariaDB 10.
  • Click “Reset root password”.
  • Choose a strong password for your root.

2 Synology NAS nextcloud setup update 2020

  • STEP 4

Basic setup. Follow the instructions in the image below.

  • Open the Web Station Package.
  • Go to General Settings.
  • Choose Apache 2.4 as HTTP back-end server.
  • Choose PHP 7.3 as PHP.

1 Synology NAS nextcloud setup update 2020

  • STEP 5

Configure PHP 7.3 Extensions. Follow the instructions in the image below.

  • Open the Web Station Package.
  • Go to PHP Settings and select PHP 7.3 then Edit.

5 Synology NAS nextcloud setup update 2020

  • STEP 6

First select “Enable PHP Cache”. Then check the following extensions:

  • bcmath
  • bz2
  • curl
  • exif
  • ftp
  • gd
  • gettext
  • iconv
  • intl
  • gmp
  • imagick
  • mailparse
  • mysqli
  • openssl
  • pdo_mysql
  • posix
  • soap
  • sockets
  • xmlrpc
  • zip

4 Synology NAS nextcloud setup update 2020

  • STEP 7

Edit PHP 7.3 Values. Open the “Core” tab and search for the following values and change them accordingly:

memory_limit= 512M
upload_max_filesize= 128M (Allows uploading maximum file size)
post_max_size= 128M
opcache.enable= 1
opcache.enable_cli= 0
opcache.interned_strings_buffer= 64
opcache.max_accelerated_files= 32531
opcache.memory_consumption= 512
opcache.save_comments= 1
opcache.revalidate_freq= 240

3 Synology NAS nextcloud setup update 2020

Now you have prepared an environment in which Nextcloud should work perfectly. The next steps are the actual installation steps.

  • STEP 8

Download the latest Nextcloud Files from here nextcloud.com/install and place the nextcloud.zip in the root of your web folder (/volume1/web/) and unzip it there.

  • STEP 9

Go back to STEP 1 or you will deal with karma 🙂

  • STEP 10

Set up Read/Write “SYSTEM” permissions to the nextcloud folder. After you click “OK“, remember to check the option “Apply to this folder, sub-folders and files“. Follow the instructions in the images below.

1 Synology NAS adjust Nextcloud permissions

2 Synology NAS adjust Nextcloud permissions

After you click “OK“, remember to check the option “Apply to this folder, sub-folders and files” then click OK.

3 Synology NAS adjust Nextcloud permissions

  • STEP 11

Go back to STEP 1. I have worked hard to make this guide work perfectly for everyone 🙂

  • STEP 12 

Now open your browser and type in http://Synology-ip-address/nextcloud Follow the instructions in the image below.

If all is good, you should find yourself at the installation page for Nextcloud. If your page is blank or you get an error, make sure Apache 2.4 and PHP 7.3 are selected in your web station/virtual host and not nginx.

6 Synology NAS nextcloud setup update 2020

  • STEP 13

Fill out the “form” according to your installation (see picture above).

  • Choose a username and password for your first user (which will be an administrator).
  • Enter root username and the password for your MariaDB 10 that you previously created at STEP 3.
  • Choose any name for the database. In my screenshot above I have chosen “nextcloud”.
  • Instead of localhost enter localhost:/run/mysqld/mysqld10.sock

Click Finish setup and wait approximately 10 minutes before Nextcloud and all apps are installed.

7 Synology NAS nextcloud setup update 2020

nextcloud synology nas setup 2

After apps are installed, go to http://Synology-ip-address/nextcloud
Enjoy your Nextcloud!

nextcloud synology nas setup 3

Works and synchronizes perfectly with multiple devices:

Nextcloud Synology NAS Mobile


Buy new domain name from GoDaddy if you want to use nextcloud with your own domain name and contact me for setup if you have any trouble following the guide below.

Virtual host or basic setup? The Synology “Web Station” package has the ability to create virtual hosts if you want to point a specific domain to your Nextcloud installation. In my case I have my own domain so I wanted to point it straight to my Nextcloud installation. I recommend you buy your own domain name if you want to use nextcloud with a domain name.

  • STEP 1 (FOLLOW THIS STEP ONLY IF YOU HAVE A DOMAIN NAME)

  • Open Web Station Package
  • Go to Virtual Host and click “Create”
  • Enter your hostname: yourdomain.com
  • Choose Ports 80/443
  • For Document root: click browse and select the folder where you want to install Nextcloud. If you choose /web/nextcloud you will be able to access your Nextcloud installation through your virtual hostname.
  • Choose Apache 2.4 as HTTP back-end server
  • Choose PHP 7.3 as PHP
  • Login to Godaddy and change your DNS A record and point it to your WAN IP.

web station create virtual host

web-station-synology-nextcloud-virtual-host

Click OK and your Virtual Host is set up. Only thing to keep in mind is your chosen installation folder.

  • STEP 2 (FOLLOW THIS STEP ONLY IF YOU HAVE A DOMAIN NAME)

Router Port Forwarding. Search Port Forwarding on your Router Settings; every router has its own graphic interface. Remember to open the following ports in your router “Port Forwarding” settings (see below). After having done so, save the settings. Port 80 will allow visitors to visit your site, while port 443 will allow visitors to visit the site via SSL protocol.
Follow the instructions in the image below.

Port 80 on TCP

Port 80 on UDP
Port 443 on TCP
Port 443 on UDP

Below you can see my nextcloud correctly work with my domain name.

nextcloud https www Synology NAS

Steps to consider after nextcloud installation:

HTTPS with Let’s Encrypt
A good practice is to use https (SSL) on any website, unless the access to your website is only on a local network. Synology has built-in Let’s Encrypt which supports great and free SSL certificates.

Create Let’s Encrypt certificate
Go to Control Panel / Security, Certificate and click “add”.
For the domain name, you can use your own domain name, just make sure your domain is pointing to your diskstation.
Unless you are using subdomains, just leave the “Subject Alternative Name:” blank.

Force HTTPS through .htaccess
Go to your Nextcloud installation folder and edit config.php in the config folder. Find the overwrite.cli.url value and change the http to https:
‘overwrite.cli.url’ => ‘https://yourdomain.com’

Note: How to Install Nextcloud Using Docker.
Note: Don’t use PHP 7.4 to run nextcloud because zip extension is missing in the latest PHP 7.4 released by Synology. Once they update the package you can run nextcloud with PHP 7.4

This post was updated on Thursday / September 24th, 2020 at 5:23 PM