Nextcloud install on UnraidJuly 12, 2021
Nextcloud is a free software for storing data on your own server. When using a client, the server is automatically synchronized with a local directory. This allows access to a consistent database from multiple computers, but also via a web interface. It is a self-hosted alternative to Google Drive.
In order to install Nextcloud as a Docker container, the Community Applications plugin is required. You can find out how to install it here.
Install Nextcloud on Unraid
Nextcloud requires a database. For this, it is best to use the MariaDB Docker from “Linuxserver”. Click on the Install button and the following window appears:
The port and also the PUID and PGID can be left at the default. However, you should always store a root password. This should be kept well, because it is always needed if you want to install a Docker that requires a MariaDB database. Here you can directly generate a secure password:
Once the Maria DB Docker is installed, you can continue with Nextcloud.
Install Nextcloud on Unraid
Nextcloud also uses the Docker from “Linuxserver”. Under the settings, the path to the directory where Nextcloud should store the data can be entered as “Host Path 2”. Again, you can leave the other settings as they are. If you had to change them, you would know it.
Once the installation is complete, you can open the web interface by opening your server IP followed by port 443 in the browser. Example: https://192.168.178.57:443
There you should see the following page:
Under “Create administrator account”, who would have thought it, the administrator account is created. The data directory can be left at the default value, where the data is stored was already defined during the Docker installation.
Under Database, enter root as the user and the password you just set. The database name can be chosen freely. It is best to simply use “Nextcloud”. Under Localhost you must specify the MariaDB Docker. So Localhost or the IP of your server followed by the port: 3306
With a click on Finish installation Nextcloud is already installed. Now you can also call Nextcloud locally. But a cloud service that only works locally is not really practical. Therefore, here are the instructions on how to make your local Nextcloud installation available worldwide.
For this the NginxProxyManager Proxy Manager is required. How to install it, you can read here: Install NginxProxyManager Proxy Manager.
If you do not have a static IP on your Internet connection, but a dynamic IP, as is usual for normal Internet connections, you still need Duck DNS. How to install and configure it, you can read here: Install DuckDNS.
Of course you can also use your own domain with a dynamic IP address. How this works in combination with a Fritz box you can read here: Use your own domain with a dynamic IP address.
Once the preparations shown in the two linked tutorials are complete, you still need to set up port sharing for Nextcloud.
Create port shares for Nextcloud
In order to make the Nextcloud installation accessible from outside your network, a port share must be created as with the NginxProxyManager. Two TCP ports can be shared. Although you can omit port 80, encrypted connections only use port 443. You can learn how to set up port shares on the most common routers here.
With the NginxProxyManager you forward the requests to the Nextcloud Docker. There you can also create a Let`s Encrypt SSL certificate to encrypt the connection.
In the web interface of the Nginx Proxy Manager you create a new proxy host. There you enter the domain or the DuckDNS domain. Then the IP and the port of the server, as shown in the picture above. Under “Scheme” you have to enter “https”.
Under the tab “SSL” you can request an SSL certificate to encrypt the connection.
Make Nextcloud available with Nginx Proxy Manager
Nextcloud has a special security feature. That’s why you will see the following error page when you try to access Nextcloud now:
To fix this you have to edit the Nextcloud Config. To do this you need to connect to your Unraid server with an FTP client. Now you have to open the config under this path: appdata/nextcloud/www/nextcloud/config/config.php
open it with a text editor of your choice. It should look something like this:
. . . 'trusted_domains' => array ( 0 => '192.168.178.39:443', ), 'dbtype' => 'mysql', 'version' => '184.108.40.206', 'overwrite.cli.url' => 'http://192.168.178.39:443', 'dbname' => 'nextcloud', . . .
The irrelevant lines above and below the entry have been omitted.
Now you have to add 3 lines:
. . . 'trusted_domains' => array ( 0 => '192.168.178.39:443', 1 => 'Subdomain.duckdns.org', ), 'dbtype' => 'mysql', 'version' => '220.127.116.11', 'overwrite.cli.url' => 'http://192.168.178.39:443', 'overwritehost' => 'Subdomain.duckdns.org', 'overwriteprotocol' => 'https', 'dbname' => 'nextcloud', . . .
The domain / subdomain must be specified twice and the “https” scheme once. The config must be saved, then you can already access the Nextcloud.