NextCloud: Difference between revisions

From FlowerHouseWiki
Line 145: Line 145:


<p>Mount the nfs-share (NAS) to the data folder where all the user files will be stored</p>
<p>Mount the nfs-share (NAS) to the data folder where all the user files will be stored</p>
<syntaxhighlight lang="console">
<syntaxhighlight lang="console" line>
mount -t nfs 192.168.88.5:/mnt/zpool1/NextCloud /home/data/
mount -t nfs 192.168.88.5:/mnt/zpool1/NextCloud /home/data/
192.168.88.5:/mnt/zpool1/NextCloud /home/data/ nfs defaults 0 0
192.168.88.5:/mnt/zpool1/NextCloud /home/data/ nfs defaults 0 0
</syntaxhighlight>
</syntaxhighlight>
<p>Re-scan all files after mounting to update file database
<p>Re-scan all files after mounting to update file database
<syntaxhighlight lang="console" line>
<syntaxhighlight lang="console">
sudo -u www-data php /var/www/nextcloud/occ files:scan --all
sudo -u www-data php /var/www/nextcloud/occ files:scan --all
</syntaxhighlight>
</syntaxhighlight>

Revision as of 18:22, 20 February 2021

NextCloud-LXC
Nextcloud.png

Network


IP: 192.168.88.10
MAC: B2:62:86:48:66:66
Domain: cloud.flowerhouse.at

System


OS: Debian Buster
RAM: 1024MB
Cores: 2
Privileged: Yes

The NextCloud-LXC is reachable under 192.168.88.10 which is located in the ServerVLAN.

The subdomain is cloud.flowerhouse.at which is handled by the ReverseProxy.

Basic Setup

Apache, MariaDB and PHP

For the NextCloud installation to work in an Container, it must be privileged, otherwise it is impossible to mount an external storage

NextCloud runs on Apache2 and uses MariaDB, so following packages have to be installed:

apt-get install apache2 libapache2-mod-php mariadb-server php-xml php-cli php-cgi php-mysql php-mbstring php-gd php-curl php-zip php-intl wget unzip

php.ini has to be edited for recommended settings:

nano /etc/php/7.3/apache2/php.ini

Change the following settings:

memory_limit = 1024M
upload_max_filesize = 1000M
post_max_size = 1000M
; 3600s = 1h
max_execution_time = 3600
date.timezone = Europe/Berlin

Start and enable all services:

systemctl start apache2
systemctl start mariadb
systemctl enable apache2
systemctl enable mariadb

Configure Database

Make secure:

mysql_secure_installation

Create database and user for NextCloud and use random generated password:

mysql -u root -p
CREATE DATABASE nextclouddb;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'RNGPASSWORD';
GRANT ALL ON nextclouddb.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download NextCloud

Download latest NextCloud-Version:

cd /var/www
wget https://download.nextcloud.com/server/releases/nextcloud-20.0.7.zip
unzip nextcloud-20.0.7.zip
rm nextcloud-20.0.7.zip
rm -r html

Configure Apache

Create an Apache virtual host configuration file:

nano /etc/apache2/sites-available/nextcloud.conf

Add the following lines:

<VirtualHost *:80>
     ServerAdmin admin@localhost
     DocumentRoot /var/www/nextcloud/
     ServerName cloud.flowerhouse.at

     Alias /nextcloud "/var/www/nextcloud/"

     <Directory /var/www/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
          <IfModule mod_dav.c>
            Dav off
          </IfModule>
        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Enable the Apache virtual host file and other required modules:

a2ensite nextcloud.conf
a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime

Restart apache service:

systemctl restart apache2

Trusted Domains

Add trusted domain:

nano /var/www/nextcloud/config/config.php

Add to file:

'trusted_domains' =>
  array (
    0 => '192.168.88.10',
    1 => 'cloud.flowerhouse.at',
  ),

Restart apache service:

systemctl restart apache2

NFS-Share

Install required packages for nfs-sare

apt install nfs-common
apt install nfs4-acl-tools

Mount the nfs-share (NAS) to the data folder where all the user files will be stored

mount -t nfs 192.168.88.5:/mnt/zpool1/NextCloud /home/data/
192.168.88.5:/mnt/zpool1/NextCloud /home/data/ nfs defaults 0 0

Re-scan all files after mounting to update file database

sudo -u www-data php /var/www/nextcloud/occ files:scan --all

Web Interface Setup

After setting up the Reverse-Proxy you can access the web interface and make the last configurations

Add admin account and the data folder path

/home/data/

.

At last add your database credentials and finish setup:

  • User: nextclouduser
  • PW: RNGPASSWORD
  • Database: nextclouddb
  • Host: localhost

Additional configuration

MaxUploadSize

client_max_body_size 100M; in reverse-proxy.conf und nginx.conf wichtig. MaxFileSize = Useable RAM https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/web/nginx.conf#L76

//NextCloud Reverse Proxy config https://help.nextcloud.com/t/connection-wizard-is-looping-between-log-in-and-grant-access/46809/4

External Storage

https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html

Sources