Links
 |
Updates between multiple major versions and downgrades are unsupported. |
Backup the database, the data directory and the config.php file.
|
sudo rm /etc/nginx/sites-enabled/nextcloud.conf
sc-reload nginx
sudo crontab -u www-data -e
sudo mariadb-dump -x -e -B nextcloud -r /var/mariadb/dump/nextcloud.sql
wget https://download.nextcloud.com/server/releases/nextcloud-27.0.2.tar.bz2
tar xjf nextcloud-*.tar.bz2
sudo mv /var/www/nextcloud /var/www/nextcloud.bak
sudo mv ~/download/nextcloud /var/www
sudo cp /var/www/nextcloud.bak/config/config.php /var/www/nextcloud/config
sudo cp -r /var/www/nextcloud.bak/data /var/www/nextcloud
sudo cp -r /var/www/nextcloud.bak/apps/[app-name] /var/www/nextcloud/apps
sudo chown -R www-data:www-data /var/www/nextcloud
sudo ln -s /etc/nginx/sites-available/nextcloud.conf /etc/nginx/sites-enabled/nextcloud.conf
sc-reload nginx
cd /var/www/nextcloud
sudo -u www-data php occ upgrade
sudo -u www-data php occ maintenance:mode --off
sudo chown -R root:root .
sudo chown -R www-data:www-data apps/ config/ data/
sudo chmod 750 config/ data/
sc-restart php8.2-fpm.service
sudo crontab -u www-data -e
|
 |
Check the version
sudo -u www-data php occ -V |
 |
Version may not be immediately updated on https://nextcloud.domain.net/status.php and
- login with an admin account
- click on user logo on top right ̣→ Administration Settings
|
Configuration
/etc/nginx/sites-available/nextcloud.conf
|
upstream php-handler {
server unix:/var/run/php/php-fpm-nextcloud.sock;
}
map $arg_v $asset_immutable {
"" "";
default "immutable";
}
server {
listen 80;
listen [::]:80;
server_name cloud.example.com;
server_tokens off;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name cloud.example.com;
root /var/www/nextcloud;
ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;
server_tokens off;
client_max_body_size 512M;
client_body_timeout 300s;
fastcgi_buffers 64 4K;
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
client_body_buffer_size 512k;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-XSS-Protection "1; mode=block" always;
fastcgi_hide_header X-Powered-By;
include mime.types;
types {
text/javascript js mjs;
}
index index.php index.html /index.php$request_uri;
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ^~ /.well-known {
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
return 301 /index.php$request_uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
location ~ \.php(?:$|/) {
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_max_temp_file_size 0;
}
location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
access_log off;
location ~ \.wasm$ {
default_type application/wasm;
}
}
location ~ \.woff2?$ {
try_files $uri /index.php$request_uri;
expires 7d;
access_log off;
}
location /remote {
return 301 /remote.php$request_uri;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
}
|
Create a php-fpm pool
/etc/php/8.2/fpm/pool.d/nextcloud.conf
|
[nextcloud]
user = www-data
group = www-data
listen = /run/php/php8.2-fpm-nextcloud.sock
listen.owner = www-data
listen.group = www-data
pm = ondemand
pm.max_children = 3
pm.process_idle_timeout = 60s
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
php_value[memory_limit] = 512M
php_value[opcache.validate_timestamps] = 0
php_value[opcache.jit] = 1255
php_value[opcache.jit_buffer_size] = 128M
php_value[opcache.interned_strings_buffer] = 64
php_value[opcache.memory_consumption] = 256
|
|
sudo -u www-data printenv PATH
sc-restart php8.2-fpm.service
|
/etc/apache2/sites-available/nextcloud.conf
|
<VirtualHost *:80>
ServerName nextcloud.domain.fr
Redirect / https://nextcloud.domain.fr/
</VirtualHost>
<VirtualHost _default_:443>
ServerName nextcloud.domain.fr
DocumentRoot /var/www/nextcloud
SSLCertificateFile /etc/letsencrypt/live/domain.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/php/php8.2-fpm-nextcloud.sock|fcgi://localhost"
SSLOptions +StdEnvVars
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/nextcloud-error.log
CustomLog ${APACHE_LOG_DIR}/nextcloud-access.log combined
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; preload"
</IfModule>
<Directory /var/www/nextcloud>
Options FollowSymlinks
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
|
config/config.php
|
'overwrite.cli.url' => 'https://nextcloud.domain.fr/',
'htaccess.RewriteBase' => '/',
|
|
sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
|
MariaDB
Increase the cache of Mariadb so it won't use swap partition when it receives a burst of requests. !!! OPTIONAL !!!
/etc/mysql/conf.d/mysql.cnf
|
[mysqld]
innodb_buffer_pool_size = 1G
innodb_io_capacity = 4000
|
|
SELECT @@innodb_buffer_pool_size/1024/1024/1024;
SELECT @@innodb_io_capacity;
|
|
sudo crontab -u www-data -e
*/5 * * * * php -f /var/www/nextcloud/cron.php
|
With admin account, change the Settings → Administration → Basic settings → Background jobs = Cron
Settings
|
sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin
|
Setting
|
Value
|
Send mode |
SMTP
|
Authentication method |
- None: to send emails on the domain only
- Plain: to send emails to other domains (cf Postfix smtpd_relay_restrictions)
|
Authentication required |
use same credential as for roundcube
|
Server address |
smtp.domain.fr:25
|
Apps
Installer des Apps:
- se connecter en admin
- cliquer sur l'icone du profile en haut à droite → Apps
Outils de gestion de taches similaire à Trello
Key
|
Value
|
IMAP host |
hostname.domain.net
|
IMAP security |
STARTTLS
|
IMAP port |
143
|
SMTP host |
hostname.domain.net
|
SMTP security |
STARTTLS
|
SMTP port |
25
|
Chat, video & audio calls
Installation sur Ubuntu 18.04
|
wget https://download.nextcloud.com/server/releases/latest-27.tar.bz2
tar xf latest-*.tar.bz2
sudo mv -T nextcloud /var/www/nextcloud
sudo chown -R root:root /var/www/nextcloud
dpkg -l php-zip php-gd php-curl php-imagick
sudo chown -R www-data:www-data apps
sudo chown -R www-data:www-data config
sudo chown -R www-data:www-data data
sudo chmod 750 config
|
|
create database nextcloud;
grant all privileges on nextcloud.* to 'nextcloud'@'localhost' identified by 'password';
flush privileges;
|
Errors
/etc/php/7.4/mods-available/apcu.ini
|
apc.enable_cli=1
|
The PHP memory limit is below the recommended value of 512MB
/etc/php/7.4/apache2/php.ini
|
memory_limit = 512M
|
config/config.php
|
'memcache.local' => '\OC\Memcache\APCu',
|
config/config.php
|
'maintenance_window_start' => 1,
|