How To Set up Nextcloud On A Synology NAS

This publish ought to inform you every thing it’s essential to know to put in Nextcloud occasion in your Synology NAS with out utilizing Docker.

I beforehand printed a publish on learn how to setup Pi-Gap on a Synology and since then quite a few individuals have requested for a information on learn how to set up Nextcloud on a Synology. After a lot of tinkering, this publish is the consequence.

I’ve talked about Nextcloud vs Synology earlier than, and why I believe Synology is the higher alternative for a house server. Nonetheless, through the use of this information you don’t want to decide on – you may set up Nextcloud in your Synology NAS!

That is more likely to be one other lengthy publish, so let’s get cracking we could?

Setup DNS

As soon as Nextcloud is all setup and dealing in your Synology NAS, you’ll in all probability wish to entry it by way of a pleasant URL, normally a subdomain like nextcloud.instance.com. If that’s the case, be sure to log into the DNS supplier to your area (that is normally the registrar you registered the area with) and configure an A report that factors to the general public IP deal with of your Synology NAS.

By doing this primary we’re giving the DNS an opportunity to propagate, so after we come to setup public entry afterward, we gained’t encounter any DNS points and we must always have the Let’s Encrypt certificates issued on our first try.

Extra on that later although. Upon getting the DNS report configured, head over to your Synology NAS, as there’s some work for us to do there subsequent…

Set up packages

The very first thing you’re going to want to do is login to your Synology and set up just a few packages (if you happen to don’t have them put in already). The packages it’s essential to set up are:

  • Synology Net Station
  • Apache HTTP server – be sure to set up the newest model. On the time of penning this publish, that’s 2.4.
  • PHP – once more, go for the newest model obtainable. On the time of writing, that’s 7.4.
  • MariaDB – you guessed it, get the newest model. On the time of writing, that’s 10.
  • While you set up MariaDB, you can be requested to set a password keep in mind this password and ensure it’s safe.
  • Depart the port set to 3307.
  • phpMyAdmin – this bundle is optionally available, however will will let you handle your MariaDB databases ought to it’s essential to.

All of those packages can be found from the primary Synology repository, so that you shouldn’t need to do something intelligent to get them put in. Simply open up the Package deal Heart and seek for every bundle.

Configure Apache & PHP

Now the pre-requisite functions are put in, it’s essential to inform Net Station to make use of Apache & PHP. To do that, open up Net Station and go to the Normal Settings tab. Change the HTTP back-end server dropdown to be Apache and the PHP dropdown to be the model you simply put in. Nextcloud runs on PHP, so if we don’t do that, Nextcloud gained’t work.

Synology Web Station config

Subsequent, go into the PHP Settings tab, spotlight the model of PHP you’re utilizing and click on the Edit button. Below Extensions choose every thing. Then click on on the Core tab, seek for memory_limit and alter it to 512M.

Synology PHP memory limit

Lastly, click on OK to use these configuration adjustments.

Allow TC/IP connections on MariaDB

The ultimate factor to do on this half is to open up the MariaDB software and verify the field that claims Allow TCP/IP connection. That is wanted so Nextcloud can hook up with our database after we configure it afterward.

Depart the port as 3307 and click on Apply.

Allow SSH entry & setup folders

You now must allow SSH entry to your Synology NAS so you may log into the command line of your Synology and configure some stuff (don’t fear, there isn’t a lot to do right here).

To allow SSH entry, go to Management Panel in your Synology and choose Terminal & SNMP. Lastly, verify the Allow SSH service choice. By default the port is 22, it’s as much as you if you wish to change this.

I’d strongly suggest ensuring the SSH port is closed in your router earlier than doing this. In any other case you can be opening up your Synology by way of SSH to the Web. Dangerous instances.

Earlier than we jump over to the command line, we have to create a shared folder inside Synology that may retailer all our Nextcloud knowledge. So whereas nonetheless in Management Panel, head over to the Shared Folder device and create a brand new shared folder.

Give the folder a reputation of nextcloud and set the Description to one thing like “This is where the Nextcloud data is stored.” For most individuals, the placement shall be volume1. Preserve clicking Subsequent on all different home windows – you don’t want to vary another choices.

Synology shared folder

Upon getting accomplished the shared folder wizard, click on Apply. You’ll now be requested to set permissions. Depart every thing default and click on OK. We are going to set further permissions from SSH in a second.

Time to SSH

Okay, we’re performed within the Synology GUI in the interim. It’s now time to actually get our hand soiled within the command line. Open your favorite command line device and SSH into your Synology. You can be requested to your consumer password to login by way of SSH. When you set a customized port for SSH, you will have to precise that in your SSH command with the -p flag.

So let’s say my username is john, my inner Synology IP deal with is 192.168.0.10 and the SSH port is 2222, my SSH command will seem like this:

ssh [email protected] -p2222

As soon as in, we have to elevate our privileges to root. To do that, run the next command (you will have to enter your password once more):

sudo su -

Now change listing into the Net Station listing:

cd /volume1/internet

Observe: The command above assumes that your Synology is working from volume1. You possibly can verify this by opening the Storage Supervisor in your Synology to see what volumes you’ve gotten configured.

Now let’s create a listing that may retailer the entrance conclusion internet element of Nextcloud:

mkdir nextcloud

As a result of we’ve got created this folder as root, we have to make the Net Station http consumer the proprietor of the nextcloud folder. We additionally want to vary the folder permissions so http can entry and handle the info on this folder. We do that with the next instructions:

chown -R http:http nextcloud
chmod -R 0770 nextcloud

The 0770 permission we’ve got simply given to nextcloud permits for the http consumer and the http group to have learn/write entry and nobody else. Whereas we’re right here, let’s give http entry to the nextcloud shared folder we created earlier as nicely so it could write to that folder too:

chown -R http:http /volume1/nextcloud
chmod -R 0770 /volume1/nextcloud

At this level chances are you’ll be confused as to why we’ve got two completely different folders, each known as nextcloud. Let me take a second to clarify…

The shared folder we made (/volume1/nextcloud) goes for use for our Nextcloud knowledge solely. So this folder won’t ever be uncovered to the web. The net folder (/volume1/internet/nextcloud) accommodates the web site information for the Web dealing with a part of Nextcloud. By retaining the 2 directories separate, we make our Nextcloud configuration safer.

Flattening Nextcloud

We’re almost completed within the SSH session. The very last thing to do is pull down the Nextcloud Net Installer bundle. To do that, navigate to [https://nextcloud.com](), click on on the Get Nextcloud button and choose Server Packages.

A popup will now seem. Choose the Net Installer tab. Proper click on the hyperlink on step 1 of the directions (highlighted under) and choose Copy Hyperlink Location. It will copy a hyperlink to the net installer file so we will obtain it to our Synology.

Nextcloud web installer

Again to the SSH session. Change listing into the nextcloud folder, then pull down the Nextcloud internet installer:

cd nextcloud
curl -O https://obtain.nextcloud.com/server/installer/setup-nextcloud.php

Your Synology will now pull down the Nextcloud internet installer. We’re performed with SSH in the interim, however depart the session open as we have to make yet another change afterward.

Setup Nextcloud

We’re now prepared to put in Nextcloud on our Synology NAS. So, open up a browser and navigate to the next deal with:

http:///nextcloud/setup-nextcloud.php

So if the interior IP deal with for my Synology is 192.168.0.10, the URL I might go to is

http://192.168.0.10/nextcloud/setup-nextcloud.php

At this level it is best to see the Nextcloud setup wizard. Click on the Subsequent button to get began.

Setup wizard step 01

Nextcloud will then run a dependency verify and since we enabled all of the PHP extensions earlier, there ought to be no points. Within the area asking the place Nextcloud ought to be put in, delete nextcloud and substitute it with a single dot:

Setup wizard step 02

Click on Subsequent once more to proceed. This will take a minute or so, however be affected person as Nextcloud is being put in. As soon as it’s performed, you’re going to get a message telling you that Nextcloud is now put in.

Superior. We now must configure our database and knowledge folders. So, click on Subsequent to proceed.

Configure Nextcloud

There are a selection of choices to configure right here. First issues first, enter the username and password you wish to use with Nextcloud. This would be the admin account, so be sure to select a powerful password.

Subsequent, click on on the Storage & database choice to increase the configuration choices. Below Knowledge folder delete the contents and substitute it with /volume1/nextcloud. That is the shared folder we created earlier.

By default, Nextcloud is configured to make use of SQLite, however that may trigger every kind of efficiency points, so change this feature to MySQL/MariaDB and fill within the particulars as follows:

  • Username: root
  • Password: The password you set if you put in MariaDB earlier
  • Database identify: This may be something you want, let’s go together with nextcloud
  • Delete localhost and substitute it with 127.0.0.1:3307
Setup wizard step 03

Lastly, I’d suggest leaving Set up beneficial apps checked. Then click on End setup. As soon as once more this step might take a minute or so to finish. Don’t fear, Nextcloud is doing a number of work within the background to get stuff configured – it’s regular.

At this level you MIGHT get a 504 error. Don’t fear, Nextcloud has put in. That is only a bizarre bug in Nextcloud. Depart it for five minutes and refresh the web page; it is best to then see the Nextcloud login web page.

That’s it! Nextcloud is now put in in your Synology NAS. We now must configure your Synology so you may really entry Nextcloud from the Web…

Configure exterior entry

At this level we have to flip again to the Synology internet interface so we will configure a brand new digital host in Net Station. Open up the Net Station software and click on on the Digital Hosts tab. From right here, click on on the Create button to setup a brand new digital host.

On this instance, I’m going to make use of the nextcloud.kevsweb.dev sub-domain. So anyplace you see this area listed, be sure to substitute it with the sub-domain you propose to make use of for Nextcloud.

Within the digital host window, choose the Title-based choice and enter your sub-domain because the hostname. Preserve Port checked; this implies the digital host will use the usual HTTP/HTTPs ports, so that you gained’t need to append your Nextcloud URL with a port quantity. When you desire to set a customized port for Nextcloud, simply change the settings as you see match.

Subsequent, set the Doc root to internet/nextcloud.

Lastly, beneath HTTPS settings, verify the HSTS choice. Set the HTTP back-end server dropdown to Apache and the PHP dropdown to the model you put in earlier. When you’re performed, the digital host config window ought to look one thing like this:

Virtual host config

Click on OK and you’re going to get a message regarding assigning permissions to this digital host. Click on Sure on this message.

Configure SSL certificates

When you had been to go to your Nextcloud occasion utilizing your URL now, you browser is more likely to complain concerning the lack of SSL. So we have to allow SSL in order that we will use HTTPS for Nextcloud – that is so Nextcloud keep safe and doesn’t leak your password to the world.

Nonetheless within the Synology internet interface, open up the Management Panel and choose Safety, then Certificates. Click on on the Add button to create a brand new certificates for Nextcloud.

  • Within the first window ensure that Add a brand new certificates is checked and click on Subsequent.
  • On the second window, give the brand new certificates an outline like “Nexctloud certificate”, choose Get a certificates from Let’s Encrypt and click on Subsequent once more.
  • On the third window, enter the area identify you wish to use, in my case that’s nextcloud.kevsweb.dev and an e mail deal with. Depart the Topic Various identify area clean.
  • Lastly, click on the Apply button and assuming the DNS adjustments you made earlier have propagated, the certificates ought to be issued efficiently.
Nextcloud certificate on synology

Nonetheless within the certificates tab, click on on the Configure button. Within the popup that seems, search for the Nextcloud digital host that you simply created earlier – this shall be proven as a website identify – and alter the certificates from the default choice to the Nextcloud certificates you simply created.

Synology select certificate

Lastly, click on OK to use these adjustments. Now if you happen to go to your Nextcloud occasion in your browser, it is best to see a legitimate certificates and no warning message. As a substitute, you’ll now get an Untrusted Area error message much like this:

Nextcloud untrust error

Keep in mind I advised you earlier there’s one thing else we have to do to within the SSH session? Properly, that is that factor. So flip again to your SSH session, be sure to’re nonetheless logged in as root, change listing to /volume1/internet/nexctloud/config and edit the config.php file.

Observe: I personally desire to make use of nano to edit information on the command line, however it’s not put in on Synology by default. If you wish to set up nano, observe this information.

When you’re modifying config.php, search for a piece of the config file that appears like this (changing the instance IP deal with with your individual):

  array (
    0 => '192.168.0.10',
  ),

So as to add our area as a trusted area in Nextcloud, add a brand new line so the config file appears like this:

  array (
    0 => '192.168.0.10',
    1 => 'nextcloud.kevsweb.dev',
  ),

Save config.php and exit the file. Now you can logout of the SSH session. When you head again to your browser and refresh your display, it is best to now be introduced with the Nextcloud login display:

Nextcloud login

Congratulations! You simply put in Nextcloud on a Synology NAS.

You need to now have the ability to login to your Nextcloud occasion utilizing the credentials your configured through the setup course of.

Conclusion

By following this course of it is best to now have a reasonably safe Nextcloud set up working in your Synology. If you wish to check the safety of your occasion, head over to the Nextcloud safety scan device to scan your new occasion. You ought to get an A+ ranking (report for my check server).

Nextcloud security scan results

I used to be contemplating penning this tutorial utilizing Docker, moderately than a non-containerised model. However evidently not all Synology gadgets have Docker obtainable to them, so I made a decision this could be a extra accessible choice. Plus, it ought to be lighter on sources than working a stack of Docker containers.

I hope you discovered this publish helpful. Identical to my latest learn how to construct a Jekyll website publish, this has been one other massive publish with a lot of work gone into it. When you’ve got discovered it helpful, please think about shopping for me a espresso to say thanks – I actually would recognize it. ?

I believe that is sufficient writing for at some point. So till subsequent time people; Kev, out.

Leave a Reply

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