Getting Started with Nextcloud on Synology NAS Devices

Author

Reads 262

Smart home wireless network router device
Credit: pexels.com, Smart home wireless network router device

To get started with Nextcloud on your Synology NAS device, you'll need to ensure that your NAS is running the latest DSM version, which is DSM 7.0 or later.

Nextcloud requires a DSM version of at least 7.0 to function properly.

First, log in to your Synology NAS device and go to the Package Center. From there, you can search for and install the Nextcloud package.

The Nextcloud package is available in the Synology Package Center, making it easy to install.

Once installed, you'll need to configure your Nextcloud settings, including setting up a username and password for the admin account.

For more insights, see: Nextcloud Mysql Version

Setup and Configuration

To set up and configure Nextcloud on your Synology NAS, start by enabling SSH access in the Control Panel. This will allow you to log into the command line and configure some essential settings.

You'll also need to create a shared folder within Synology to store your Nextcloud data. Name the folder "nextcloud" and set the description to something like "This is where the Nextcloud data is stored." The location will typically be volume1.

Credit: youtube.com, How to Set Up Nextcloud on a Synology NAS! (Tutorial)

Before configuring Nextcloud, make sure to set the SSH port to a secure value, and close the port on your router to prevent external access.

To configure Nextcloud, enter the admin username and password, and then click on the Storage & database option to expand the configuration options. Replace the default data folder with the shared folder you created earlier.

You should also change the database type from SQLite to MySQL/MariaDB, and fill in the details accordingly. Don't forget to delete localhost and replace it with 127.0.0.1:3307.

After configuring Nextcloud, you might encounter a 504 error. Don't worry, this is just a weird bug in Nextcloud. Leave it for 5 minutes and refresh the page; you should then see the Nextcloud login page.

To access Nextcloud from the Internet, set the Document root to web/nextcloud. That's it! You've successfully installed Nextcloud on your Synology NAS.

Here are the key settings you'll need to configure:

Setup DNS

Credit: youtube.com, DNS Configuration - CompTIA A+ 220-1101 - 2.6

To access Nextcloud via a nice URL, you'll need to set up a DNS record that points to your Synology NAS's public IP address.

This involves logging into your domain's DNS provider, which is usually your domain registrar.

Make sure to configure an A record with the public IP address of your Synology NAS.

This will give the DNS a chance to propagate, which is essential for setting up public access later on.

By doing this first, you should be able to get the Let's Encrypt certificate issued on your first attempt, avoiding potential DNS issues.

Take a look at this: Nextcloud Trusted Domain

Enable SSH & Setup Folders

To enable SSH access, go to Control Panel on your Synology and select Terminal & SNMP, then check the Enable SSH service option.

The default SSH port is 22, but you can change it if you want.

Make sure to close the SSH port on your router before enabling it to avoid exposing your Synology to the internet.

Take a look at this: Nextcloud Port

Credit: youtube.com, Learn SSH In 6 Minutes - Beginners Guide to SSH Tutorial

Create a shared folder within Synology that will store all your Nextcloud data by going to the Shared Folder tool in Control Panel.

Name the folder "nextcloud" and set the Description to something like "This is where the Nextcloud data is stored."

The shared folder will likely be located on volume1, so click Next on all other windows without making any changes.

Set the permissions to default and click OK, as you'll set additional permissions from SSH later.

The shared folder we made (/volume1/nextcloud) is going to be used for our Nextcloud data only and will never be exposed to the internet.

To confirm your Synology is working from volume1, open the Storage Manager to see what volumes you have configured.

By keeping the shared folder separate from the web folder (/volume1/web/nextcloud), you make your Nextcloud configuration more secure.

Configure

To configure Nextcloud, start by setting up the admin account with a strong password. This will be the account you use to access and manage Nextcloud.

Electronics Engineer Fixing Cables on Server
Credit: pexels.com, Electronics Engineer Fixing Cables on Server

Next, click on the Storage & database option to expand the configuration options. Here, you'll need to change the data folder to /volume1/nextcloud, which is the shared folder you created earlier.

You'll also need to change the database from SQLite to MySQL/MariaDB. To do this, enter the following details:

• Username: root

• Password: The password you set when you installed MariaDB earlier

• Database name: nextcloud

• Host: 127.0.0.1:3307

It's also recommended to leave the "Install recommended apps" checkbox checked during the setup process.

After completing these steps, Nextcloud may display a 504 error. Don't worry, this is a known bug and will resolve itself after a few minutes. Simply refresh the page and you should see the Nextcloud login screen.

To access Nextcloud from the internet, you'll need to set the document root to web/nextcloud. This will allow you to access Nextcloud through your NAS's IP address.

To enable SSL encryption for Nextcloud, create a new certificate in the Synology web interface. Select "Get a certificate from Let's Encrypt" and enter your domain name and email address. Once the certificate is issued, apply it to the Nextcloud virtual host.

If this caught your attention, see: Synology Change Phone Backup from Google Drive

Man with small modern device for storage and transfer information
Credit: pexels.com, Man with small modern device for storage and transfer information

To configure the initial settings for Nextcloud, access the web interface and create a login and password for the admin account. Nextcloud will then prompt you to install recommended apps, which you can choose to install or skip.

To optimize database performance, run the following command in the CLI or task scheduler as the root user:

For caldav and carddav functionality, additional steps may be required. However, you can skip these if you don't need these services.

To configure folder permissions for Nextcloud, add the admin group and grant read and write permissions. Apply these permissions to all files and subfolders.

To check the security of your Nextcloud server, use the special page provided by the developers.

To install the bz2 module, run the following commands in the CLI and restart the nextcloud-app container:

Note: If you're using a TerraMaster NAS, you'll need to install Nginx Proxy Manager to set up reverse proxy for Nextcloud.

For your interest: Reverse Proxy Nextcloud

CalDAV and CardDAV URLs

Credit: youtube.com, Sync Synology CardDAV contact & CalDAV calendar with Outlook (2022 newest method, URL discovered)

The CalDAV and CardDAV URLs issue only appears if you haven't configured a virtual host for Nextcloud.

You'll see a message saying your web server is not properly configured to resolve "./well-known/caldav" (or "./well-known/carddav)".

This is because Nextcloud is located in a subdirectory, and the default values for the URLs come from the document root.

To fix this, you need to configure a virtual host for Nextcloud or install it directly in the document root (/web).

Installing Nextcloud directly in the document root means you can't operate any other website in the document root.

Setting up a virtual host for Nextcloud requires a host (subdomain) just for Nextcloud.

The problem can be solved by adding the subfolder to the URL, but this doesn't work on Synology's NAS devices.

You'll need to try out different solutions, such as searching online for other fixes, if the above steps don't work for you.

Synology DiskStation

Synology DiskStation is a popular choice for hosting Nextcloud due to its flexibility and comprehensive features. Synology offers its own cloud solution, Synology Drive, but it's nowhere near as extensive and flexible as Nextcloud.

Credit: youtube.com, 10 Minute Install of Nextcloud on a Synology NAS (Container Manager / Docker Compose / MariaDB)

Nextcloud can be installed on a Synology DiskStation using the WebStation, which has been revised in DSM 7.2, allowing for easier installation. The demand for Nextcloud is still high, making it a popular choice among users.

To install Nextcloud on a Synology DiskStation, follow the step-by-step guide provided in the article, which explains how to do so.

Synology DiskStation with DSM 7.2

Synology DiskStation with DSM 7.2 is here, and it's a major update. The WebStation has been revised, making it a great time to install Nextcloud on your Synology NAS.

The demand for Nextcloud is still high, and for good reason - it's a more comprehensive and flexible cloud solution than Synology Drive. You can install Nextcloud on your Synology NAS using a step-by-step guide, which explains how to get started.

To enable SSH access on your Synology NAS, go to Control Panel and select Terminal & SNMP. Check the Enable SSH service option, and make sure to change the default port if you want to.

Consider reading: Install Nextcloud Ubuntu

Credit: youtube.com, Synology DSM 7.2 Review - Should You Buy?

Before you start, create a shared folder within Synology to store your Nextcloud data. Name it "nextcloud" and set the description to something like "This is where the Nextcloud data is stored." The location will be volume1, so make sure to click Next on all other windows.

Here's a quick rundown of the shared folder settings:

By keeping the two directories separate - the shared folder for Nextcloud data and the web folder for the Internet-facing part of Nextcloud - you make your configuration more secure. This is important to keep in mind, especially if you're using SSH access to configure your Synology NAS.

Shared Folder

Creating a shared folder on your Synology DiskStation is a crucial step in setting up your Nextcloud installation. You can create a shared folder via the DSM Control Panel or using PuTTY as root.

To create a shared folder, you'll need to go to DSM > Control Panel > Shared Folder. Here, you can create a new shared folder and give it a name like "nextcloud". Make sure to set the Description to something like "This is where the Nextcloud data is stored."

Credit: youtube.com, How to Create Share Folder in Synology NAS

The shared folder should be located on a volume that's not exposed to the internet, like volume1. You can confirm this by opening the Storage Manager on your Synology. This will help keep your Nextcloud data secure.

You should only make changes to the shared folder via PuTTY as root, otherwise the ownership will change and Nextcloud can no longer access the folder/files.

Here are the steps to create a shared folder:

  1. Open the DSM Control Panel and go to “Shared Folder”
  2. Create a new shared folder and give read and write access to the previously created group (docker-users)
  3. Create two folders in the newly created shared folder, one for nextcloud and the other for mariadb
  4. Make sure the folders are owned by the docker-users group

By following these steps, you'll be able to create a shared folder that's secure and accessible to Nextcloud.

Security and Permissions

To ensure the security of your Nextcloud installation on Synology, it's essential to set permissions as strictly as possible.

During installation, permissions are set loosely to allow the process to complete, but it's recommended to adjust them afterwards using scripts. This can be done by creating a file with a .sh extension using PuTTY and inserting specific code, which you can then run with a command.

Be aware that Nextcloud may not be fully functional after installation, and some adjustments are necessary for error-free operation, secure use, and functioning cloud updates. These adjustments can be found in the Administrator Settings menu, specifically in the Security and Configuration Warnings section.

On a similar theme: Nextcloud Security

Configure Certificate

Credit: youtube.com, Configure Microsoft Certificate Based Authentication

In order to secure your Nextcloud instance, you need to enable SSL.

To do this, open the Synology web interface and navigate to the Control Panel, then select Security and Certificate.

Click on the Add button to create a new certificate for Nextcloud, making sure to check Add a new certificate and click Next.

Select Get a certificate from Let's Encrypt and click Next again, then enter the domain name you want to use and an email address.

Leave the Subject Alternative name field blank and click Apply, assuming the DNS changes you made earlier have propagated, the certificate should be issued successfully.

To configure the certificate, click on the Configure button in the certificate tab and look for the Nextcloud virtual host that you created earlier.

Change the certificate from the default option to the Nextcloud certificate you just created, then click OK to apply those changes.

Now, if you visit your Nextcloud instance in your browser, you should see a valid certificate and no warning message, instead you will get an Untrusted Domain error message.

Runtime Permissions

Credit: youtube.com, Android Permissions - Part 1, Intro to Runtime permissions

During the installation of Nextcloud, the permissions for the folder and data directory are set loosely to allow the installation to proceed.

This loose permission setting is necessary for the installation process, but it's not ideal for security reasons.

The permissions should be set as strictly as possible for optimal security.

For example, if you've set wider permissions again for an update, it's a good idea to adjust the permissions using scripts.

You can use PuTTY to create a file with the ending .sh on your DiskStation.

Insert the following code into the file, paying close attention to the single and double quotation marks.

You can then run the script with the command mentioned in the example.

Important

After installing Nextcloud on your Synology NAS, it's essential to address some critical settings to ensure error-free operation and secure use. Nextcloud will often suggest necessary adjustments through error and advisory messages in the menu under Administrator Settings > Overview > Security and Configuration Warnings.

Credit: youtube.com, Practice-Web: User Security and Permissions

These messages might prompt you to make changes to the configuration, and it's crucial to find out where these changes can be made effectively. On a Synology NAS, the DiskStation might not behave like a normal Linux server, so be prepared to dig a bit deeper to make the necessary adjustments.

To avoid issues with the cron, you'll need to make some configuration changes for the CLI version of PHP. Don't worry, it's a straightforward process, and you'll be able to find the necessary information in the Nextcloud documentation.

To get started, take a look at the Security and Configuration Warnings in the Administrator Settings menu. This will give you a clear idea of what needs to be addressed.

Troubleshooting and Optimization

You'll likely see some errors in the admin area under Overview, but don't worry, it's just Nextcloud telling you how it's optimized and configured for actual use.

To fix these errors, you'll need to restart the web server, which can be a bit complicated.

One way to do this is to restart the DiskStation, or you can set up a start and a stop task for Apache using the task scheduler.

Optimization

Low angle of various connectors and USB cables placed on shelf with storage engineer inscription
Credit: pexels.com, Low angle of various connectors and USB cables placed on shelf with storage engineer inscription

Optimization is a crucial step in ensuring your Nextcloud setup runs smoothly. You'll likely see some errors in the admin area under Overview, which will give you a good idea of how your Nextcloud is optimized and configured for actual use.

One way to address these errors is to restart the web server. This can be a bit complicated, but you have a few options. You can restart the DiskStation, set up a start and a stop task for Apache using the task scheduler, or change the PHP version in a vHost, which will also restart Apache.

Before making any changes, it's essential to undo any changes you made to the database installation script. Nextcloud checks all files for changes and issues a warning message, which can interfere with the update. To fix this, open the file /volumeX/Nextcloud/lib/private/Setup/MySQL.php and insert the removed command segments again. Alternatively, you can copy the file from the Nextcloud zip and adjust the privileges again.

Detailed view of a black data storage unit highlighting modern technology and data management.
Credit: pexels.com, Detailed view of a black data storage unit highlighting modern technology and data management.

Faulty database code can also cause issues. Nextcloud's setup automatically creates a database including tables and its own user, but the syntax used may cause problems with Synology's version of MariaDB 10. To fix this, you'll need to adjust the problematic lines in the file /volumeX/web/Nextcloud/lib/private/Setup/MySQL.php. Specifically, you should remove the line ", ISecureRandom::CHAR_DIGITS. ISecureRandom::CHAR_LOWER. ISecureRandom::CHAR_UPPER".

Issues

Issues can arise during the installation of the Community Document Server app, especially when trying to install it via the browser. The app is quite large, weighing in at over 200 MB.

If you encounter installation problems, you can try installing it via the command line using the following command: sudo -u http php74 -d memory_limit=512M occ app:install documentserver_community. Increasing the memory limit is crucial for a smooth installation process.

Synology users might experience issues due to a missing file, but there's a workaround. Download libstdc++ 6 for Debian from here.

To resolve the issue, follow these steps:

  1. Download libstdc++ 6 for Debian
  2. Unpack the file data.tar.\usr\lib\x86_64-linux-gnu\libstdc++.so.6.0.25
  3. Rename the file to libstdc++.so.6

The file you're unpacking is a real file, not a symbolic link, which is why you need to rename it.

Background Jobs via Cron

Credit: youtube.com, Linux Crash Course - Scheduling Tasks with Cron

To set up background jobs via Cron in Nextcloud, enter a name and leave the user as root. Under Schedule, specify that the task should be carried out every 5 minutes and every day.

It's helpful to be notified by email if the task could not be executed correctly. This can be done by checking the "Send execution details by email" option.

Under "User-defined script", enter the following line. However, it's essential to create new files via the command line, as creating them on your computer and uploading them can result in incorrect encoding.

Always check the "Send execution details by email" option to receive notifications if the task fails. This will help you troubleshoot any issues that may arise.

To verify that the Cron option is working, go to Settings > Basic Settings > Background Tasks in the Nextcloud web interface and activate the Cron option. Wait a little more than 5 minutes and reload the page. The dot next to the heading should be green, and the last execution should be less than 5 minutes ago.

For your interest: Nextcloud Email

Webserver Timeout

Credit: youtube.com, Slow Web Server - Troubleshooting and Debugging Techniques

Webserver Timeout is an issue that can cause frustration for Synology users, especially when using Nextcloud. The timeout is set to a default value that may not be sufficient for all users.

To increase the timeout for Nginx, which is used as a proxy server, you can connect to your NAS via SSH and make changes as root.

You'll need to open the file /var/packages/WebStation/target/misc/VirtualHost-nginx-mustache in the editor.

Add the line proxy_read_timeout 3600s; in the block for Apache 2.2 or Apache 2.4 under include proxy.conf;. You can also insert the line in both blocks.

Save and close the file, then first test the Nginx configuration and restart it if the test is positive.

The timeout for the proxy is now increased when using virtual hosts. However, Apache can still timeout, which can be fixed by creating a new file /usr/local/etc/apache2X/sites-enabled/user.conf (as root) and inserting the two lines TimeOut 3600 and ProxyTimeout 3600.

A fresh viewpoint: Nextcloud Nginx

Docker and Containers

Credit: youtube.com, 5 AWESOME DOCKER CONTAINERS for Synology NAS and homelabing

In the world of Docker, you'll need to create a network for your Nextcloud setup. Go to the Network tab in the Docker GUI and click Add to create a new network.

A good name for your network is nextcloud-network, so go ahead and enter that in the prompt. Leave only "Enable IPv4" checked, as we won't be using IPv6 for this setup.

Now that you've added the network, it's time to add it to your list. Click the "Add network" button to confirm its addition.

With your network set up, you're ready to create a container for the database that Nextcloud will use.

Advanced Topics

One of the most powerful features of Nextcloud on Synology is its ability to integrate with other services, such as LDAP and Active Directory, allowing for seamless user authentication and management.

You can configure Nextcloud to use LDAP or Active Directory by following the instructions in the "Configuring LDAP and Active Directory" section, which allows you to connect to your existing directory services.

Credit: youtube.com, 15 Apps I use on NextCloud to replace Google and Other Services

Nextcloud also supports the use of external storage, such as USB drives and external hard drives, which can be mounted directly to the Nextcloud server, expanding your storage capacity.

To mount an external drive, you'll need to create a new mount point and configure the drive's permissions in the "Mounting External Drives" section.

Nextcloud's encryption feature ensures that all data stored on the server is protected with end-to-end encryption, keeping your files safe from unauthorized access.

This encryption is enabled by default, but you can adjust the encryption settings in the "Encryption Settings" section to suit your needs.

Nextcloud also supports the use of two-factor authentication, which adds an extra layer of security to the login process, making it even harder for unauthorized users to access your data.

To enable two-factor authentication, follow the instructions in the "Two-Factor Authentication" section, which will guide you through the process of setting up a second authentication factor.

Nextcloud's web interface is highly customizable, allowing you to tailor the look and feel of your Nextcloud server to suit your needs.

You can customize the web interface by modifying the themes and layouts in the "Customizing the Web Interface" section, which provides a range of options for customizing the appearance of your Nextcloud server.

You might like: Synology Google Drive

Next Steps

Credit: youtube.com, How to Set Up Your Own Nextcloud Server...Step-by-Step!

You can use Nextcloud directly in your browser or download the client, which works similarly to Dropbox's. The client allows you to synchronize your entire cloud with your computer or just individual folders.

Synchronizing individual folders is especially helpful if you have an existing folder structure for your data, such as images, videos, and files, and you want to keep it. This way, you can keep your existing organization intact.

The client also enables the use of multiple Nextcloud instances, which is useful if you have multiple clouds or want to separate your data. The client app for smartphones offers the option of automatically uploading images, which is convenient for those who take a lot of photos.

Before using Nextcloud, it's essential to carry out optimization measures to ensure your cloud is adequately secured and performs well. You'll likely see some errors in the admin area under Overview, but don't worry, these are just areas for improvement.

Explore further: Alternative to Nextcloud

Network and Firewall

Credit: youtube.com, How to Set up Firewall on Synology NAS (and why you probably do not need one)

To set up Nextcloud on Synology, you'll need to configure the network and firewall settings. Ensure the Synology Firewall is enabled, as it's a crucial security feature.

If you've enabled the firewall, you'll need to add the network of your Nextcloud project to the allow rule. This is because the network changes each time you create a new project.

In my case, the network was 192.168.192 with a subnet mask of 20, which translates to 255.255.240.0.

Virtual Host

Having a virtual host for your cloud is a great way to secure Nextcloud and avoid configuration conflicts. This is because a virtual host allows you to use an individual PHP profile for Nextcloud, which can be better secured and less prone to problems.

To create a virtual host, you'll need to open the Web Station and create a new profile under Script Language Settings. Enter a name and a description for the profile.

Credit: youtube.com, NAT and Firewall Explained

Selecting the right PHP version is crucial. For example, you can choose PHP 8.2 or higher, which is recommended for Nextcloud. This will allow you to take advantage of the latest features and security patches.

When customizing the PHP open_basedir, make sure to include the paths to the shared folder and the Nextcloud data folder. This will ensure that Nextcloud has access to the necessary files and directories.

Here are the PHP extensions you should activate for Nextcloud:

  • bcmath
  • bz2
  • curl
  • exif
  • ftp
  • gd
  • gmp
  • iconv
  • imagick
  • intl
  • mysqli
  • openssl
  • pdo_mysql
  • posix
  • sodium
  • ssh2
  • sysvsem
  • zip
  • zlib

Adjusting the PHP variables is also important. You'll need to set the memory limit to at least 2GB, and the post_max_size and upload_max_filesize to a high value, such as 16G. This will allow Nextcloud to handle large file uploads and prevent errors.

Разрешить Сеть на Фаерволе

If you have Synology's firewall enabled, you need to add your Nextcloud project's network to the allow rule.

To find your project's network, look for the IP address and subnet mask specified in the Synology Firewall setup article.

In my case, the network is 192.168.192 with a subnet mask of 20, which equals 255.255.240.0.

This network changes every time you create a new project.

To add your network to the allow rule, go to the firewall settings and create a new rule above the block rule.

Mona Renner

Senior Copy Editor

Mona Renner is a meticulous and detail-driven Copy Editor with a passion for refining complex concepts into clear and concise language. With a keen eye for grammar and syntax, she has honed her skills in editing articles across a range of technical topics, including Google Drive APIs. Her expertise lies in distilling technical jargon into accessible and engaging content that resonates with diverse audiences.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.