Page modifiée le :

VM debian 12 Bookworm avec Nextcloud 26 sur Freebox Delta

Pré-requis :

Ce mémo supose un certains nombres de pré-requis avant de pouvoir s'en servir.

Créer la VM :

Au 5 mai 2023, l'image de Debian 12 Bookworm n'est pas disponible dans la console d'administration de la Freebox ; je suis passé par une version stable 11 Bullseye que j'ai mis à jour en Debian 12 Bookworm.

Pensez à ajouter votre clef publique pour ssh !

Ajouter une ipv6 fixe :

En ipv4, il y a une sorte de protection contre les accès extérieurs. Seul l'adresse de la box est visible depuis l'extérieur, la box pouvant translater certains ports vers une/des adresses derrières la box (NAT).

En ipv6 tout le monde est accessible indifféremment. Un préfixe est attribué et le reste est libre. Pour retrouver un peu de sécurité, le partie derrière l'ipv6 est généralement dynamique et change régulièrement.

Pour avoir une ipv6 fixe, regarder votre adresse actuelle sur la VM :

root@my2:/home/freebox# ip -6 address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2a01:e0a:195:1040:fc84:fdff:fe53:7676/64 scope global dynamic mngtmpaddr 
       valid_lft 82196sec preferred_lft 82196sec
    inet6 fe80::fc84:fdff:fe53:7676/64 scope link 
       valid_lft forever preferred_lft forever
root@my2:/home/freebox#

L'adresse qui nous intéresse est 2a01:e0a:195:1040:fc84:fdff:fe53:7676/64, 2a01:e0a:195:1040 est la partie préfixe assignée par Free, le gros du reste est libre et peu être directement accessible de l'extérieur.

On crée un fichier dans /etc/network/interfaces.d/

root@my2:/home/freebox# nano /etc/network/interfaces.d/60-static-ipv6
auto enp0s3
iface enp0s3 inet6 static
address 2a01:e0a:195:1040:cdaf:219b:207e:d723
netmask 64

Logout de la VM.

Redémarrer la VM depuis le site d'administartion de la freebox.

Vérifier par la commande ip -6 address la création automatique de la nouvelle adresse.

Installation du serveur web, de mysql et d'autre paquets requis :

root@my2:/home/freebox# apt install apache2 libapache2-mod-php php-mbstring php-xml php-zip unzip fail2ban certbot python3-certbot-apache php-gd php-curl php-intl php-bcmath php-imagick php-gmp php-apcu mariadb-server php-mysql libmagickcore-6.q16-6-extra
Reading package lists... Done 
Building dependency tree... Done 
Reading state information... Done 
The following packages were automatically installed and are no longer required: libbpf0 libcbor0 libdns-export1110 libicu67 libisc-export1105 libldap-2.4-2 libmpdec3 libprocps8 libpython3.9-minimal libpython3.9-stdlib libtevent0 liburing1 net-tools python3.9 python3.9-minimal Use 'apt autoremove' to remove them. 
The following additional packages will be installed: apache2-bin apache2-data apache2-utils augeas-lenses fontconfig-config fonts-dejavu-core fonts-droid-fallback fonts-noto-mono fonts-urw-base35 galera-4 gawk ghostscript gsfonts imagemagick-6-common libabsl20220623 libaom3 libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libaugeas0 libavahi-client3 libavahi-common-data libavahi-common3 
libavif15 libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libcups2 libdav1d6 libdaxctl1 libdbd-mariadb-perl libdbi-perl libde265-0 libdeflate0 libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libfftw3-double3 
libfontconfig1 libfontenc1 libgav1-1 libgd3 libgomp1 libgs-common libgs10 libgs10-common libheif1 libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libice6 libidn12 libijs-0.35 libio-html-perl libjansson4 libjbig0 libjbig2dec0 libjpeg62-turbo liblcms2-2 liblerc4 liblqr-1-0 libltdl7 liblua5.3-0 liblwp-mediatypes-perl liblzo2-2 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmariadb3 
libmpfr6 libndctl6 libonig5 libopenjp2-7 libpaper-utils libpaper1 libpmem1 librav1e0 libregexp-ipv6-perl libsigsegv2 libsm6 libsnappy1v5 libsvtav1enc1 libterm-readkey-perl libtiff6 libtimedate-perl liburi-perl libwebp7 libwebpdemux2 libwebpmux3 libx11-6 libx11-data libx265-199 libxau6 libxcb1 libxdmcp6 libxext6 libxpm4 libxslt1.1 libxt6 libyuv0 libzip4 lsof mariadb-client mariadb-client-core mariadb-common mariadb-plugin-provider-bzip2 
mariadb-plugin-provider-lz4 mariadb-plugin-provider-lzma mariadb-plugin-provider-lzo mariadb-plugin-provider-snappy mariadb-server-core mysql-common php-common php8.2-apcu php8.2-bcmath php8.2-cli php8.2-common php8.2-curl php8.2-gd php8.2-gmp php8.2-imagick php8.2-intl php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline php8.2-xml php8.2-zip poppler-data pv python3-acme python3-augeas python3-certbot python3-configargparse python3-
distro python3-icu python3-josepy python3-openssl python3-parsedatetime python3-pyinotify python3-rfc3339 python3-systemd rsync ssl-cert whois x11-common xfonts-encodings xfonts-utils Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser augeas-doc python-certbot-doc python3-certbot-nginx mailx monit sqlite3 fonts-noto fonts-freefont-otf | fonts-freefont-ttf fonts-texgyre gawk-doc php-pear augeas-tools cups-
common libmldbm-perl libnet-daemon-perl libsql-statement-perl libfftw3-bin libfftw3-dev libgd-tools libdata-dump-perl libipc-sharedcache-perl liblcms2-utils libmagickcore-6.q16-6-extra libbusiness-isbn-perl libwww-perl mariadb-test netcat-openbsd poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum doc-base python-acme-doc python-certbot-
apache-doc python-openssl-doc python3-openssl-dbg python-pyinotify-doc python3-braceexpand zip The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils augeas-lenses certbot fail2ban fontconfig-config fonts-dejavu-core fonts-droid-fallback fonts-noto-mono fonts-urw-base35 galera-4 gawk ghostscript gsfonts imagemagick-6-common libabsl20220623 libaom3 libapache2-mod-php libapache2-mod-php8.2 libapr1 
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libaugeas0 libavahi-client3 libavahi-common-data libavahi-common3 libavif15 libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libcups2 libdav1d6 libdaxctl1 libdbd-mariadb-perl libdbi-perl libde265-0 libdeflate0 libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libfftw3-double3 libfontconfig1 libfontenc1 libgav1-1 libgd3 libgomp1 libgs-common libgs10 libgs10-
common libheif1 libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libice6 libidn12 libijs-0.35 libio-html-perl libjansson4 libjbig0 libjbig2dec0 libjpeg62-turbo liblcms2-2 liblerc4 liblqr-1-0 libltdl7 liblua5.3-0 liblwp-mediatypes-perl liblzo2-2 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmariadb3 libmpfr6 libndctl6 libonig5 libopenjp2-7 libpaper-utils libpaper1 libpmem1 librav1e0 libregexp-
ipv6-perl libsigsegv2 libsm6 libsnappy1v5 libsvtav1enc1 libterm-readkey-perl libtiff6 libtimedate-perl liburi-perl libwebp7 libwebpdemux2 libwebpmux3 libx11-6 libx11-data libx265-199 libxau6 libxcb1 libxdmcp6 libxext6 libxpm4 libxslt1.1 libxt6 libyuv0 libzip4 lsof mariadb-client mariadb-client-core mariadb-common mariadb-plugin-provider-bzip2 mariadb-plugin-provider-lz4 mariadb-plugin-provider-lzma mariadb-plugin-provider-lzo mariadb-plugin-
provider-snappy mariadb-server mariadb-server-core mysql-common php-apcu php-bcmath php-common php-curl php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-xml php-zip php8.2-apcu php8.2-bcmath php8.2-cli php8.2-common php8.2-curl php8.2-gd php8.2-gmp php8.2-imagick php8.2-intl php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline php8.2-xml php8.2-zip poppler-data pv python3-acme python3-augeas python3-certbot python3-certbot-
apache python3-configargparse python3-distro python3-icu python3-josepy python3-openssl python3-parsedatetime python3-pyinotify python3-rfc3339 python3-systemd rsync ssl-cert unzip whois x11-common xfonts-encodings xfonts-utils 
0 upgraded, 171 newly installed, 0 to remove and 0 not upgraded.
Need to get 61.4 MB of archives. 
After this operation, 365 MB of additional disk space will be used. 
Do you want to continue? [Y/n] Y
...
root@my2:/home/freebox#

Sécurisation du serveur de base de données :

root@my2:/home/freebox# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
Dropping test database... ... Success!
Removing privileges on test database... ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
root@my2:/home/freebox#

On crée une base et utilisateur :

root@my2:/home/freebox# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \\g.
Your MariaDB connection id is 40
Server version: 10.11.2-MariaDB-1 Debian n/a

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.

MariaDB [(none)]\> CREATE DATABASE nextcloud;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]\> CREATE USER 'admin'@'localhost' IDENTIFIED BY 'super_mdp'; 

Query OK, 0 rows affected (0.004 sec)

MariaDB [(none)]\> GRANT ALL PRIVILEGES ON nextcloud.* TO 'admin'@'localhost' WITH GRANT OPTION ;
Query OK, 0 rows affected (0.003 sec)

MariaDB [(none)]\> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]\> exit
Bye
root@my2:/home/freebox#

On vérifie que l'utilisateur peut se connecter :

root@my2:/home/freebox# mysql -u admin -psuper_mdp
Welcome to the MariaDB monitor.  Commands end with ; or \\g. Your MariaDB connection id is 46 Server version: 10.11.2-MariaDB-1 Debian n/a

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.

MariaDB [(none)]\> exit
Bye

On télécharge Nextcloud 26 :

root@my2:/home/freebox# cd /var/www
root@my2:/var/www# wget https://download.nextcloud.com/server/releases/latest-26.zip
\--2023-04-07 18:22:48--  https://download.nextcloud.com/server/releases/latest-26.zip
Resolving download.nextcloud.com (download.nextcloud.com)... 2a01:4f9:2a:3119::181, 95.217.64.181
Connecting to download.nextcloud.com (download.nextcloud.com)|2a01:4f9:2a:3119::181|:443... connected.HTTP request sent, awaiting response... 200 OK
Length: 184987285 (176M) [application/zip]
Saving to: ‘latest-26.zip’

latest-26.zip                                              100%[========================================================================================================================================>] 176\.42M  48.8MB/s    in 3.9s

2023-04-27 08:11:03 (44.8 MB/s) - ‘latest-26.zip’ saved [184987285/184987285]

root@my2:/var/www# unzip ./latest-26.zip
...
root@my2:/var/www# ls -l
total 180660
drwxr-xr-x  2 root root      4096 Apr  7 18:03 html
\-rw-r--r--  1 root root 184987285 Apr 19 15:47 latest-26.zip
drwxr-xr-x 14 root root      4096 Apr 19 15:42 nextcloud
root@my2:/var/www# rm latest-26.zip

On crée un répertoire pour les données :

root@my2:/var/www# root@my2:/var/www# mkdir nextcloud-datas 
root@my2:/var/www# chown -R www-data:www-data nextcloud nextcloud-datas

Faire la résolution de nom

Faire en sorte de faire pointer l'adresse ServerName et/ou ServerAlias vers l'adresse ip renseignée plus haut.
ex : sur un poste client, éditer le fichier hosts et ajouter une ligne comme :

2a01:e0a:195:1040:cdaf:219b:207e:d723 my2 my2.ducouet.fr

Sur ce poste client allez avec un navigateur sur l'adresse my2.ducouet.fr

On doit tomber sur la page d'acceuil d'Apache.

On crée un "virtualhost" pour Apache :

root@my2:/var/www# nano /etc/apache2/sites-available/010.nextcloud.conf
<VirtualHost *:80>
ServerAdmin bruno@ducouet.fr
ServerName my2.ducouet.fr
ServerAlias my2
DocumentRoot /var/www/nextcloud
</VirtualHost>

Dans la VM, activons Nextcloud :

root@my2:/var/www# a2ensite 010.nextcloud
Enabling site 010.nextcloud.
To activate the new configuration, you need to run:
systemctl reload apache2
root@my2:/var/www# systemctl reload apache2
root@my2:/var/www#
root@my2:/var/www# ls -l /etc/apache2/sites-enabled
total 0
lrwxrwxrwx 1 root root 35 Apr  7 18:03 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 37 Apr 27 08:44 010.nextcloud.conf -> ../sites-available/010.nextcloud.conf
root@my2:/var/www#

Installation de Nextcloud :

Sur le poste client actualisez la page my2.ducouet.fr pour lancez l'instalation :

Instalation de Nextcloud

Finalisation de l'installation :

Une fois l'installation effectuée, veuillez vérifier les erreurs ou les recommandations d'améliorations.

Dans Paramètres d'administration -> vue d'ensemble :

Avertissements de sécurité & configuration

Il est important pour la sécurité et la performance de votre instance que celle-ci soit correctement configurée. Afin de vous aider, votre instance Nextcloud effectue des vérifications automatiques.
Pour de plus amples informations, veuillez consulter la documentation liée.

Il y a quelques erreurs concernant votre configuration.

La limite de mémoire PHP est inférieure à la valeur recommandée de 512 Mo.
PHP configuration option output_buffering must be disabled

Accès non sécurisé au site via HTTP. Il est fortement conseillé de configurer votre serveur pour exiger HTTPS à la place, comme décrit dans les conseils de sécurité ↗.

Votre serveur web nest pas configuré correctement pour résoudre "/.well-known/webfinger". Plus d'informations peuvent être trouvées sur notre documentation.
Votre serveur web nest pas configuré correctement pour résoudre "/.well-known/nodeinfo". Plus d'informations peuvent être trouvées sur notre documentation.
Votre serveur web nest pas configuré correctement pour résoudre "/.well-known/caldav". Plus d'informations peuvent être trouvées sur notre documentation.
Votre serveur web nest pas configuré correctement pour résoudre "/.well-known/carddav". Plus d'informations peuvent être trouvées sur notre documentation.

Vous n'avez pas encore défini ou vérifié la configuration de votre serveur de messagerie. Veuillez vous diriger vers les Paramètres de base afin de les définir.
Ensuite, utilisez le bouton "Envoyer un e-mail" sous le formulaire pour vérifier vos paramètres.

Votre installation n’a pas de préfixe de région par défaut. C’est nécessaire pour valider les numéros de téléphone dans les paramètres du profil sans code pays.
Pour autoriser les numéros sans code pays, veuillez ajouter "default_phone_region" avec le code ISO 3166-1 respectif de la région dans votre fichier de configuration.

Pas de mémoire cache configurée. Pour améliorer les performances, merci de configurer un memcache, si disponible. Des informations sont disponibles dans la documentation ↗.

Merci de consulter les guides d'installation ↗ et de vérifier les erreurs ou avertissements des logs.

Vérifier la sécurité de votre Nextcloud grâce à notre scan de sécurité ↗

Let's Encrypt :

Vous avez un nom de domaine fonctionnel my2.ducouet.fr accessible de l'extérieur ? Utilisez Let's Encrypt pour avoir un accès https :

root@my2:/home/freebox# certbot --apache -d 'my2.ducouet.fr'
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
(Enter 'c' to cancel): xxxxx@ducouet.fr

Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
agree in order to register with the ACME server. Do you agree?

(Y)es/(N)o: Y

Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.

(Y)es/(N)o: N
Account registered.
Requesting a certificate for my2.ducouet.fr

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/my2.ducouet.fr/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/my2.ducouet.fr/privkey.pem
This certificate expires on 2023-07-26.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for my2.ducouet.fr to /etc/apache2/sites-available/010.nextcloud-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://my2.ducouet.fr

If you like Certbot, please consider supporting our work by:

* Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
* Donating to EFF:                    https://eff.org/donate-le

root@my2:/home/freebox#

On édite le fichier 010.nextcloud-le-ssl.conf :

Ajoutez le header qui suit et les rewrite pour les .well-known.

root@my2:/home/freebox# nano /etc/apache2/sites-available/010.nextcloud-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin bruno@ducouet.fr
ServerName my1.ducouet.fr
ServerAlias my2
DocumentRoot /var/www/nextcloud

SSLCertificateFile /etc/letsencrypt/live/my1.ducouet.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my1.ducouet.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/.well-known/host-meta /public.php?service=host-meta [QSA,L]
RewriteRule ^/.well-known/host-meta.json /public.php?service=host-meta-json [QSA,L]
RewriteRule ^/.well-known/webfinger /index.php/.well-known/webfinger [R=301,L]
RewriteRule ^/.well-known/nodeinfo /index.php/.well-known/nodeinfo [R=301,L]
RewriteRule ^/.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^/.well-known/caldav /remote.php/dav/ [R=301,L]
</IfModule>

</VirtualHost>
</IfModule>

On active le module headers d'Apache :

root@my2:/home/freebox# a2enmod headers
Enabling module headers.
To activate the new configuration, you need to run:
systemctl restart apache2
root@my2:/home/freebox# systemctl restart apache2
root@my2:/home/freebox#

On crée un fichier de conf pour php

root@my2:/home/freebox# nano /etc/php/8.2/apache2/conf.d/99-conf.nextcloud.ini
;;;;;;;;;;;;;;;;;;;;;;
; limite mémoire php ;
;;;;;;;;;;;;;;;;;;;;;;
memory_limit = 1G

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PHP configuration option output_buffering must be disabled ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
output_buffering = Off

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Pas de mémoire cache configurée. Configurer un memcache ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
apc.enable_cli=On

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
post_max_size = 2G
upload_max_filesize = 2G

apc.enable_cli ne semble pas pris en compte par cron, essayez de l'ajouter dans /etc/php/8.2/cli/conf.d/ ou ajouter le directement sur la ligne de commande dans la crontab (Voir plus bas).

root@my2:/home/freebox# chmod +x /etc/php/8.2/apache2/conf.d/99-conf.nextcloud.ini
root@my2:/home/freebox#

Pour le cache et Ajouter “default_phone_region” avec le code ISO 3166-1 respectif de la région dans votre fichier de configuration

root@my2:/home/freebox# nano /var/www/nextcloud/config/config.php
'memcache.local' => '\\OC\\Memcache\\APCu',
'default_phone_region' => 'FR',

Pour le mail

'mail_smtpmode' => 'smtp',
'mail_smtphost' => 'ssl0.ovh.net',
'mail_sendmailmode' => 'smtp',
'mail_from_address' => 'bruno',
'mail_domain' => 'ducouet.fr',
'mail_smtpauth' => 1,
'mail_smtpsecure' => 'ssl',
'mail_smtpport' => '465',
'mail_smtpauthtype' => 'PLAIN',
'mail_smtpname' => 'postmaster@ducouet.fr',
'mail_smtppassword' => 'super_mdp',

Pour cron :

root@my2:/home/freebox# crontab -u www-data -e no crontab for www-data - using an empty one

*/5  *  *  *  * /usr/bin/php -f /var/www/nextcloud/cron.php --define apc.enable_cli=1

crontab: installing new crontab
root@my2:/home/freebox# systemctl restart cron