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 also install Nextcloud on your Synology NAS with DSM version 6.2.4.

Note: This guide works perfectly with the latest Nextcloud 22.0.0 version and DSM 7.

  • 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.46
  • PHP 7.4.9
  • phpMyAdmin 4.9.6
  • MariaDB 10.3.27

Note: Once you install the MariaDB 10 package, you will have to set a root password. You will need this root password on STEP 10 of this article.

  • STEP 3

Download the latest Nextcloud version from the official Nextcloud website nextcloud.com/install and place the nextcloud zip in the root of your web folder (/volume1/web/). Right click on the zip file and extract it in the web folder. Follow the instructions in the image below.

1 set up Synology NAS install nextcloud DSM 7

  • STEP 4

Your web folder should look like this.

2 set up Synology NAS install nextcloud DSM 7

  • STEP 5

Right click on the nextcloud folder then click Properties. Follow the instructions in the image below.

3 set up Synology NAS install nextcloud DSM 7

  • STEP 6

Go to the Permission tab then click Create. Follow the instructions in the image below.

4 set up Synology NAS install nextcloud DSM 7

  • STEP 7

On the User or group dropdown menu choose SYSTEM then check all Read and Write Permissions. Click Done. Follow the instructions in the image below.

5 set up Synology NAS install nextcloud DSM 7

  • STEP 8

After you click Done on STEP 7, check “Apply to this folder, sub-folders and files“. Click Save. Follow the instructions in the image below.

6 set up Synology NAS install nextcloud DSM 7

  • STEP 9

Configure PHP. Follow the instructions in the image below.

  • Open the Web Station Package.
  • Go to Script Language Settings and click the Create tab.

7 set up Synology NAS install nextcloud DSM 7

  • STEP 10

After you click Create on STEP 9, a new window will open. Go to the Settings tab and choose your Profile name, your Description and the PHP 7.4 version, then check Enable PHP cache. Follow the instructions in the image below.

8 set up Synology NAS install nextcloud DSM 7

  • STEP 11

Next tab: “Extensions“.

9 set up Synology NAS install nextcloud DSM 7

Check the following extensions. Follow the instructions in the image above.

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

Next tab: “Core“. Search for the following values and change them accordingly:

memory_limit= 512M
upload_max_filesize= 128M (Allows uploading of maximum file size. If you need to upload bigger files, you can set 4000M = 4GB)
post_max_size= 128M
opcache.enable= 1
opcache.enable_cli= 1
opcache.interned_strings_buffer= 64
opcache.max_accelerated_files= 32531
opcache.memory_consumption= 512
opcache.save_comments= 1
opcache.revalidate_freq= 240

10 set up Synology NAS install nextcloud DSM 7

After you have changed all the values above, click the Save button.

  • STEP 13

  • Open the Web Station Package.
  • Go to Web Service Portal.
  • Choose Apache 2.4 as HTTP back-end server.
  • Choose the PHP 7.4 profile created at STEPS 9-12 then click Save.

Follow the instructions in the image below.

11 set up Synology NAS install nextcloud DSM 7

  • STEP 14

Open the phpMyAdmin package you have previously downloaded from Package Center at STEP 2 of this article. Log in with your MariaDB 10 root credentials. Create the nextcloud database. Follow the instructions in the image below. Go to the phpMyAdmin Databases tab. In the Create database field, type in nextcloud then click the Create button. Follow the instructions in the image below. Note: To login via phpMyAdmin remember the username for phpMyAdmin is root and the password is the one for MariaDB 10 you have previously set at STEP 2.

1 Synology NAS nextcloud DSM 7 create database phpMyAdmin

  • STEP 15

After the nextcloud database was successfully created at STEP 14, select it from the left panel then go to the phpMyadmin Privileges tab, and click Add user account. Follow the instructions in the image below.

2 Synology NAS nextcloud DSM 7 create database phpMyAdmin

  • STEP 16

After you click Add user account on STEP 15, you will see the page below. Choose a User name, then click the Generate button. This button will Generate a random password. Copy paste this password in the Password field and in the Re-type field. Follow the instructions in the image below.

3 Synology NAS nextcloud DSM 7 create database phpMyAdmin

  • STEP 17

Scroll down the page a little bit and click the Go button. Follow the instructions in the image below.

4 Synology NAS nextcloud DSM 7 create database phpMyAdmin

  • STEP 18

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

  • STEP 19

Now open your browser and type in http://Synology-ip-address/nextcloud

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.4 are selected on STEP 13. Follow the instructions in the images below.

12 set up Synology NAS install nextcloud DSM 7

Note: If you can’t connect to the database with 127.0.0.1:3007 try with 127.0.0.1:3006
Note: If you continue to have trouble and can’t connect to the database try with localhost:3007 or localhost:3006 on DSM 7 I could connect with localhost:3006 instead 127.0.0.1:3007
Note: For DSM 6.2.4 try 127.0.0.1:3307 or 127.0.0.1:3306 or localhost:3307 or localhost:3306
So in the end, try the combination that works for you!

If you continue to experience trouble open MariaDB 10 package then check “Enable TCP/IP connection“. Click Apply and try again to connect to your Nextcloud.

Enable TCP-IP MariaDB 10

  • STEP 20

After you click Finish setup on STEP 19 the recommended apps will be installed. Just be patient because it will take up to 10 minutes.

3 Synology NAS nextcloud DSM 7 login set up

  • STEP 21

Enjoy Nextcloud!

4 Synology NAS nextcloud DSM 7 login set up

  • STEP 22

Set permissions! Go to Control Panel / Task Scheduler / Create / Scheduled Task / User-defined script. Follow the instructions in the image below.

1 Synology DSM 7 Nextcloud set up permissions

  • STEP 23

Once you click on User-defined script, a new window will open. Follow the instructions below:

  1. General: In the Task field type in “Nextcloud Permissions“. Uncheck “Enabled” option. Select root user.
  2. Schedule: Select Run on the following date then select “Do not repeat“.
  3. Task Settings: Check “Send run details by email“, add your email then copy paste the code below in the Run command area. After that click OK.
chown -R http:http /volume1/web/nextcloud
chmod -R 0770 /volume1/web/nextcloud

2 Synology DSM 7 Nextcloud set up permissions

After you click OK above you will see a warning pop-up message. Click OK.

3 Synology DSM 7 Nextcloud set up permissions

Note: If you have your nextcloud folder in a different volume, then change in the code above /volume1/web/nextcloud according to your settings. For example: /volume2/web/nextcloud or /volume3/web/nextcloud etc.

  • STEP 24

After you click OK on STEP 23, select your “Nextcloud Permissions” Task then click the “Run” tab. You will be asked to run Nextcloud Permissions – click Yes. Follow the instructions in the image below.

4 Synology DSM 7 Nextcloud set up permissions

  • STEP 25

Go back to STEP 1 or you will deal with karma 🙂 You have already been warned on STEP 18 🙂

Works and synchronizes perfectly with multiple devices:

Nextcloud Synology NAS Mobile


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

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 the Web Station Package
  • Go to Web Service Portal and click the “Create” tab.

1 Synology DSM 7 nextcloud set up domain name

Select Virtual Host as portal.

2 Synology DSM 7 nextcloud set up domain name

  • Enter your hostname: yourdomain.com
  • Choose Ports 80/443
  • For Document root: click Browse and select your Nextcloud folder. 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.4 as PHP
  • Login to Godaddy and change your DNS A record and point it to your WAN IP.

3 Synology DSM 7 nextcloud set up domain name

Click Create 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)

Log into your router and go to the Port Forwarding area. Select your NAS Local IP Address and port forward ports 80 and 443 both TCP/UDP. Remember that every router has its own interface design. At the moment I am using an RT2600ac router. Follow the instructions in the image below:

4 Synology DSM 7 nextcloud set up domain name

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

nextcloud https www Synology NAS

Note: Synology: How to Automatically Redirect HTTP to HTTPS in Nextcloud

Steps to consider after the 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 NAS.
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: Nextcloud together with the OnlyOffice document server.

This post was updated on Monday / July 12th, 2021 at 8:21 AM