Nextlcoud on Synology NAS

This blog will walk through the steps necessary to install and configure Nextcloud 15 on Synology NAS running DSM 6.2.

The following packages need to be installed on the NAS:

  • Webstation
  • Appache HTTP Server 2.4
  • PHP 7.0
  • MariaDB 10

It’s recommended by Nextcloud to keep your data outside of the internet accessible folder so first we setup a shared folder to keep the data:

  • Control Panel -> Shared Folder -> Create
  • Name: Nexcloud
  • Disable Recycling Bin
  • Choose you’re encryption preferences and your advanced setting
  • Confirm “Apply”
  • Edit Permission as desired
  • Important: Add Group “http” with Read/Write access

Now a lot of guides I have found on the web tell you to log into your NAS and change the owner and permission of this shared folder to http. I don’t like to do this out of two reasons. First, http should have no access rights to my shared folders for security reasons and second, if you do that you can’t access your data anymore via the File Station.

So here is a little workaround to solve this problem:

  • ssh into your disk station and change to /volume1/Nextcloud
  • Change to root user with “sudo su -“
  • Create a folder called “Data” and issue two commands:
    • chown -R http:http Data 
    • chmod -R 0770 Data

With this little change we’ll be able to get Nextcloud to write to this folder, don’t have http owning the shared folder and still be able to access the files.

Next setup MariaDB:

  • Open MariaDB
  • Enter new root password <DB_ROOT>

Next configure Webstation

Virtual Host configuration

  • General: Check you have Appache 2.4 and PHP 7.0 selected
  • PHP Settings: 
    • Create: Name
    • open_base_dir enter you data directory
    • Extension: bz2, curl, gd, iconv, intl, mysqli, openssl, pdo_mysql, posix, zip
  • Virtual Host
    • Create: Name
    • Your virtual hostname
    • Document root folder “web/nextcloud”
    • HTTP Sever = Apache
    • PHP = Nextcloud PHP (7.0)

Next we are getting Nexcloud

  • Download the Nextcloud Server Package from nextcloud.com
  • Unzip the nextcloud-15.0.0.zip and you get a folder “nextcloud”
  • Move all content from the folder in your Synology web/nextcloud folder

Change ownership permission on web/nextcloud folder

  • Open FileStation
  • Go to web/nextcloud – Permission
  • Change owner to “http”
  • Change permission for http to “Read & Write”

Setting up Nextcloud

  • Go to web browser and enter “https://<Your Host Name>”
  • Enter username: <your name> (don’t use admin)
  • Enter a password
  • Data Folder is: /volume1/Nextcloud/Data
  • Database:
    • root
    • MarinaDB password
    • nextcloud
    • 127.0.01:3307

That’s it your Nextcloud should be starting up. It might take a few minutes until it’s ready to connect and you get an HTTP timeout.