Nextcloud (Ubuntu 18.04): Unterschied zwischen den Versionen
(→Apache) |
|||
(51 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
== Voraussetzungen == | |||
== | |||
<pre> | <pre> | ||
Zeile 11: | Zeile 6: | ||
<pre> | <pre> | ||
sudo apt-get install -y php-curl php-gd php-json php-mbstring php-zip php-xml php-common php-mysql php-intl php-imagick | sudo apt-get install -y libapache2-mod-php php-curl php-gd php-json php-mbstring php-zip php-xml php-common php-mysql php-intl php-imagick php-bcmath php-gmp | ||
</pre> | </pre> | ||
== | == Installation == | ||
<pre> | <pre> | ||
Zeile 28: | Zeile 23: | ||
sudo chown -R www-data:www-data nextcloud19_0_0 | sudo chown -R www-data:www-data nextcloud19_0_0 | ||
sudo ln -s nextcloud19_0_0 nextcloud | sudo ln -s nextcloud19_0_0 nextcloud | ||
</pre> | |||
== MariaDB-Datenbank anlegen == | |||
<pre> | |||
mysql -u root -p | |||
mysql> create database if not exists nextcloud; | |||
mysql> create user 'nextcloud'@'%' identified by '<password>'; | |||
mysql> grant all on nextcloud.* to 'nextcloud'@'%'; | |||
mysql> flush privileges; | |||
mysql> quit; | |||
</pre> | </pre> | ||
Zeile 35: | Zeile 41: | ||
<pre> | <pre> | ||
sudo a2enmod rewrite && sudo a2enmod headers && sudo a2enmod env && sudo a2enmod dir && sudo a2enmod mime | sudo a2enmod rewrite && sudo a2enmod headers && sudo a2enmod env && sudo a2enmod dir && sudo a2enmod mime && sudo a2enmod ssl | ||
sudo systemctl restart apache2.service | sudo systemctl restart apache2.service | ||
</pre> | </pre> | ||
==== Conf-Datei ==== | |||
<pre> | <pre> | ||
sudo vi /etc/apache2/ | sudo vi /etc/apache2/conf-available/nextcloud.conf | ||
</pre> | </pre> | ||
Zeile 54: | Zeile 62: | ||
Dav off | Dav off | ||
</IfModule> | </IfModule> | ||
</Directory> | </Directory> | ||
</pre> | </pre> | ||
Zeile 66: | Zeile 73: | ||
http://10.0.0.176/nextcloud/ | http://10.0.0.176/nextcloud/ | ||
</pre> | </pre> | ||
==== Port 443 (HTTPS) ==== | |||
Erstellung eines SSL-Zertifikates siehe [[SSL_Zertifikat]] | |||
<pre> | |||
sudo vi /etc/apache2/sites-available/nextcloud.conf | |||
</pre> | |||
<pre> | |||
<VirtualHost *:80> | |||
ServerName nextcloud.kirner.or.at | |||
Redirect / https://nextcloud.kirner.or.at | |||
</VirtualHost> | |||
</pre> | |||
<pre> | |||
sudo vi /etc/apache2/sites-available/nextcloud-ssl.conf | |||
</pre> | |||
<pre> | |||
<VirtualHost *:443> | |||
ServerName nextcloud.kirner.or.at | |||
ServerAlias nextcloud.kirner.or.at | |||
SSLEngine on | |||
SSLCertificateFile /etc/ssl/certs/nextcloud.crt | |||
SSLCertificateKeyFile /etc/ssl/private/apache.key | |||
# Pfad zu den Webinhalten | |||
DocumentRoot /mnt/synology/web1/www/nextcloud | |||
<IfModule mod_headers.c> | |||
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" | |||
</IfModule> | |||
KeepAlive On | |||
KeepAliveTimeout 5 | |||
ErrorLog ${APACHE_LOG_DIR}/nextcloud.kirner.or.at-error.log | |||
CustomLog ${APACHE_LOG_DIR}/nextcloud.kirner.or.at-access.log combined | |||
</VirtualHost> | |||
</pre> | |||
<pre> | |||
sudo a2ensite nextcloud | |||
sudo a2ensite nextcloud-ssl | |||
sudo systemctl reload apache2.service | |||
</pre> | |||
== Optionale Konfigurationen == | |||
=== Cronjobs === | |||
<pre> | |||
sudo crontab -e | |||
</pre> | |||
<pre> | |||
*/5 * * * * sudo -u www-data php -f /mnt/synology/web1/www/nextcloud/cron.php | |||
</pre> | |||
==== Links ==== | |||
[https://docs.nextcloud.com/server/19/admin_manual/configuration_server/background_jobs_configuration.html https://docs.nextcloud.com/server/19/admin_manual/configuration_server/background_jobs_configuration.html] | |||
=== Redis Server === | |||
==== Installation ==== | |||
siehe [[Redis-Server (Ubuntu)|Redis-Server]] | |||
==== Konfiguration ==== | |||
<pre> | |||
sudo vi /mnt/synology/web1/www/nextcloud/config/config.php | |||
</pre> | |||
<pre> | |||
'filelocking.enabled' => true, | |||
'memcache.locking' => '\OC\Memcache\Redis', | |||
'memcache.local' => '\OC\Memcache\Redis', | |||
'redis' => array( | |||
'host' => '/var/run/redis/redis-server.sock', | |||
'port' => 0, | |||
'timeout' => 0.0, | |||
'dbindex' => 1, // use different database for different applications | |||
), | |||
</pre> | |||
==== Links ==== | |||
[https://docs.nextcloud.com/server/19/admin_manual/configuration_files/files_locking_transactional.html https://docs.nextcloud.com/server/19/admin_manual/configuration_files/files_locking_transactional.html] | |||
=== HTTP2 === | |||
==== Installation ==== | |||
siehe [[Apache HTTP (Linux)#HTTP2 einrichten|Apache HTTP#HTTP2 einrichten]] | |||
==== Links ==== | |||
[https://docs.nextcloud.com/server/19/admin_manual/installation/server_tuning.html https://docs.nextcloud.com/server/19/admin_manual/installation/server_tuning.html] | |||
=== Die PHP-Speichergrenze liegt unterhalb des empfohlenen Wertes von 512MB === | |||
Die Dateien | |||
<pre> | |||
sudo vi /etc/php/7.3/apache2/php.ini | |||
</pre> | |||
und | |||
<pre> | |||
sudo vi /etc/php/7.3/fpm/php.ini | |||
</pre> | |||
editieren und jeweils folgenden Eintrag anpassen: | |||
<pre> | |||
memory_limit = 512M | |||
</pre> | |||
== Security == | |||
Siehe [[Nextcloud_Security_(Linux)|Nextcloud_Security]] | |||
== Update == | |||
=== Allgemein === | |||
<pre> | |||
cd /mnt/synology/web1/www/nextcloud/ | |||
sudo -u www-data php occ maintenance:mode --on | |||
sudo -u www-data php /mnt/synology/web1/www/nextcloud/updater/updater.phar | |||
sudo -u www-data php occ maintenance:mode --off | |||
</pre> | |||
==== Links ==== | |||
[https://docs.nextcloud.com/server/stable/admin_manual/maintenance/upgrade.html https://docs.nextcloud.com/server/stable/admin_manual/maintenance/upgrade.html] | |||
=== Nextcloud 21 === | |||
==== Dem Modul php-imagick fehlt die SVG-Unterstützung. Für eine bessere Kompatibilität wird empfohlen, es zu installieren. ==== | |||
<pre> | |||
sudo apt-get install libmagickcore-6.q16-6-extra | |||
</pre> | |||
===== Links ===== | |||
[https://blog.wydler.eu/2021/04/12/nextcloud-21-php-erweiterung-php-imagick-fehlt/ https://blog.wydler.eu/2021/04/12/nextcloud-21-php-erweiterung-php-imagick-fehlt/] | |||
=== Nextcloud 22 === | |||
==== The PHP OPcache module is not properly configured ==== | |||
'''The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.''' | |||
Die Dateien | |||
<pre> | |||
sudo vi /etc/php/7.3/apache2/php.ini | |||
</pre> | |||
und | |||
<pre> | |||
sudo vi /etc/php/7.3/fpm/php.ini | |||
</pre> | |||
editieren und jeweils folgenden Einträge einkommentieren: | |||
<pre> | |||
opcache.enable=1 | |||
opcache.enable_cli=1 | |||
opcache.interned_strings_buffer=8 | |||
opcache.max_accelerated_files=10000 | |||
opcache.memory_consumption=128 | |||
opcache.save_comments=1 | |||
opcache.revalidate_freq=1 | |||
</pre> | |||
Folgenden Eintrag auf ''64'' erhöhen: | |||
<pre> | |||
opcache.interned_strings_buffer=64 | |||
</pre> | |||
Danach die Konfiguration neu laden: | |||
<pre> | |||
sudo systemctl reload apache2.service | |||
</pre> | |||
===== Links ===== | |||
[https://help.nextcloud.com/t/the-php-opcache-is-not-properly-configured/36147 https://help.nextcloud.com/t/the-php-opcache-is-not-properly-configured/36147] | |||
== Apps == | |||
[[Nextcloud Apps (Ubuntu 18.04)|Nextcloud Apps]] | |||
== Links == | == Links == |
Aktuelle Version vom 20. Februar 2022, 12:08 Uhr
Voraussetzungen
sudo apt-get update
sudo apt-get install -y libapache2-mod-php php-curl php-gd php-json php-mbstring php-zip php-xml php-common php-mysql php-intl php-imagick php-bcmath php-gmp
Installation
https://nextcloud.com/install/
cd ~/temp wget https://download.nextcloud.com/server/releases/nextcloud-19.0.0.zip unzip nextcloud-19.0.0.zip sudo mv nextcloud /mnt/synology/web1/www/nextcloud19_0_0 cd /mnt/synology/web1/www/ sudo chown -R www-data:www-data nextcloud19_0_0 sudo ln -s nextcloud19_0_0 nextcloud
MariaDB-Datenbank anlegen
mysql -u root -p mysql> create database if not exists nextcloud; mysql> create user 'nextcloud'@'%' identified by '<password>'; mysql> grant all on nextcloud.* to 'nextcloud'@'%'; mysql> flush privileges; mysql> quit;
Konfiguration
Apache
sudo a2enmod rewrite && sudo a2enmod headers && sudo a2enmod env && sudo a2enmod dir && sudo a2enmod mime && sudo a2enmod ssl sudo systemctl restart apache2.service
Conf-Datei
sudo vi /etc/apache2/conf-available/nextcloud.conf
Alias /nextcloud "/mnt/synology/web1/www/nextcloud/" <Directory /mnt/synology/web1/www/nextcloud/> Require all granted AllowOverride All Options FollowSymLinks MultiViews <IfModule mod_dav.c> Dav off </IfModule> </Directory>
sudo a2ensite nextcloud.conf sudo systemctl reload apache2.service
http://10.0.0.176/nextcloud/
Port 443 (HTTPS)
Erstellung eines SSL-Zertifikates siehe SSL_Zertifikat
sudo vi /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80> ServerName nextcloud.kirner.or.at Redirect / https://nextcloud.kirner.or.at </VirtualHost>
sudo vi /etc/apache2/sites-available/nextcloud-ssl.conf
<VirtualHost *:443> ServerName nextcloud.kirner.or.at ServerAlias nextcloud.kirner.or.at SSLEngine on SSLCertificateFile /etc/ssl/certs/nextcloud.crt SSLCertificateKeyFile /etc/ssl/private/apache.key # Pfad zu den Webinhalten DocumentRoot /mnt/synology/web1/www/nextcloud <IfModule mod_headers.c> Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" </IfModule> KeepAlive On KeepAliveTimeout 5 ErrorLog ${APACHE_LOG_DIR}/nextcloud.kirner.or.at-error.log CustomLog ${APACHE_LOG_DIR}/nextcloud.kirner.or.at-access.log combined </VirtualHost>
sudo a2ensite nextcloud sudo a2ensite nextcloud-ssl sudo systemctl reload apache2.service
Optionale Konfigurationen
Cronjobs
sudo crontab -e
*/5 * * * * sudo -u www-data php -f /mnt/synology/web1/www/nextcloud/cron.php
Links
Redis Server
Installation
siehe Redis-Server
Konfiguration
sudo vi /mnt/synology/web1/www/nextcloud/config/config.php
'filelocking.enabled' => true, 'memcache.locking' => '\OC\Memcache\Redis', 'memcache.local' => '\OC\Memcache\Redis', 'redis' => array( 'host' => '/var/run/redis/redis-server.sock', 'port' => 0, 'timeout' => 0.0, 'dbindex' => 1, // use different database for different applications ),
Links
HTTP2
Installation
siehe Apache HTTP#HTTP2 einrichten
Links
https://docs.nextcloud.com/server/19/admin_manual/installation/server_tuning.html
Die PHP-Speichergrenze liegt unterhalb des empfohlenen Wertes von 512MB
Die Dateien
sudo vi /etc/php/7.3/apache2/php.ini
und
sudo vi /etc/php/7.3/fpm/php.ini
editieren und jeweils folgenden Eintrag anpassen:
memory_limit = 512M
Security
Siehe Nextcloud_Security
Update
Allgemein
cd /mnt/synology/web1/www/nextcloud/ sudo -u www-data php occ maintenance:mode --on sudo -u www-data php /mnt/synology/web1/www/nextcloud/updater/updater.phar sudo -u www-data php occ maintenance:mode --off
Links
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/upgrade.html
Nextcloud 21
Dem Modul php-imagick fehlt die SVG-Unterstützung. Für eine bessere Kompatibilität wird empfohlen, es zu installieren.
sudo apt-get install libmagickcore-6.q16-6-extra
Links
https://blog.wydler.eu/2021/04/12/nextcloud-21-php-erweiterung-php-imagick-fehlt/
Nextcloud 22
The PHP OPcache module is not properly configured
The OPcache interned strings buffer is nearly full. To assure that repeating strings can be effectively cached, it is recommended to apply opcache.interned_strings_buffer to your PHP configuration with a value higher than 8.
Die Dateien
sudo vi /etc/php/7.3/apache2/php.ini
und
sudo vi /etc/php/7.3/fpm/php.ini
editieren und jeweils folgenden Einträge einkommentieren:
opcache.enable=1 opcache.enable_cli=1 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=10000 opcache.memory_consumption=128 opcache.save_comments=1 opcache.revalidate_freq=1
Folgenden Eintrag auf 64 erhöhen:
opcache.interned_strings_buffer=64
Danach die Konfiguration neu laden:
sudo systemctl reload apache2.service
Links
https://help.nextcloud.com/t/the-php-opcache-is-not-properly-configured/36147
Apps
Links
https://docs.nextcloud.com/server/19/admin_manual/installation/
https://docs.nextcloud.com/server/19/admin_manual/installation/example_ubuntu.html
Zurück zu Nextcloud