NextCloud
Setting up NextCloud on Raspberry Pi 3.
Either Apache or Nginx will do. I chose nginx due to being recommended as less-resource-intensive.
Prerequisites are (the list may not be comprehensive):
- web server (link)
- php7.0
- sqlite3
Preparation
Web Server
After nginx has been installed, as per Web Server instructions, perform additional configuration for NextCloud.
Install all the prerequisites (link).
- nginx configuration (link)
- php7.0 and modules
FCP
I had to edit "/etc/php/7.0/fpm/pool.d/www.conf" to see the value "listen = /run/php/php7.0-fpm.sock".
The configuration example was using localhost:9000 instead of the value above. Added this to nginx site config and everything worked.
php-fpm
php-fpm configuration (link).
Edit "/etc/php/7.0/fpm/pool.d/www.conf" and enable the line env["PATH"].
Data Storage
I am going to store the data directory on a USB flash drive.
USB Storage
NextCloud Data directory can be established on a USB flash drive. This allows for speed and low power usage. It is anyway recommended to store the data directory outside the web directory structure.
See more on Storage page, especially the Automount section for assigning permissions/groups for NextCloud.
Format the flash drive with ext4 filesystem and add to fstab.
Create the data directory (i.e. nc-data) on the drive and assign the permissions to www-data user:
sudo chown www-data:www-data nc-data
Links
- External USB drive with NextCloudPi (link)
Installation
Links
- Installation Manual (link)
Configuration
The NextCloud configuration file is located at /var/www/nextcloud/config/config.php
For Nginx configuration, see Nginx page.
Set the data directory location during installation. It should be located outside the www directory.
Symlinks thread (link).
Trusted Domains
Assign all domains on which the server will be accessed (link).
Email
Install sendmail to be able to send emails from NextCloud.
Links
- (link)
External Storage
This feature allows attaching external storage. Just provide a name for the folder that will appear in the files root, use "Local" and enter the location of the HDD directory, for example.
Install "smbclient" to access any Windows shares on the network. Multiple other providers are available.
Links
Security
If the server is exposed to the Internet, follow the above instructions on how to secure it.
If it is already protected by a router/firewall, you can only allow HTTPS port forwarding on the router. On the server you could then enable both HTTP and HTTPS ports.
Maintenance / Logs
NextCloud error log is by default stored in the data directory configured in config/config.php. It can be changed by editing this file. (link)
The log is located at /var/log/nextcloud.log. It is possible that the file does not exist, in which case you need to create it and chown to www-data.