From bc58b6db1adf1f6e9283cc871ce7985be23132bf Mon Sep 17 00:00:00 2001 From: btatu Date: Fri, 22 Jul 2022 11:45:16 +0200 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20de=20la=20page=20HowtoMatomo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HowtoMatomo.md | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 HowtoMatomo.md diff --git a/HowtoMatomo.md b/HowtoMatomo.md new file mode 100644 index 00000000..d5b55d4d --- /dev/null +++ b/HowtoMatomo.md @@ -0,0 +1,110 @@ +--- +title: Howto Matomo +categories: web webapp +... + +* Documentation : + +Matomo est une application web affichant des statistiques de consultation de pages web tout en protégeant les données et la vie privée des internautes. + + +## Installation + +Il y a besoin de ces près-requis pour Debian 10 (Buster) : + +~~~ +# apt install php php-curl php-gd php-cli php-mysql php-xml php-mbstring php-fpm apache2 libapache2-mpm-itk libapache2-mod-php +~~~ + +### Compte UNIX + +Créer un compte UNIX : + +~~~ +# adduser matomo +~~~ + +### Vhost Apache + +Admettons que l'application sera accessible depuis https://domaine-matomo-instance.com. + +On conseil au moins l'usage de ces directives dans `/etc/apache2/sites-enabled/matomo.conf` : + +~~~ + + + ServerName domaine-matomo-instance.com + + DocumentRoot /home/matomo/www/ + + SSLEngine on + SSLProtocol all -SSLv2 -SSLv3 + SSLCertificateKeyFile /etc/letsencrypt/live/domaine-matomo-instance.com/privkey.pem + SSLCertificateFile /etc/letsencrypt/live/domaine-matomo-instance.com/fullchain.pem + + AssignUserID matomo matomo + + CustomLog /var/log/apache2/access.log vhost_combined + CustomLog /home/matomo/log/access.log combined + ErrorLog /home/matomo/log/error.log + + UseCanonicalName On + RewriteEngine On + RewriteCond %{HTTPS} !=on [OR] + RewriteCond %{HTTP_HOST} !^domaine-matomo-instance.com$ + RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R] + + #php_admin_flag engine off + #AddType text/html .html + #php_admin_flag display_errors On + #php_flag short_open_tag On + #php_flag register_globals On + #php_admin_value memory_limit 256M + php_admin_value max_execution_time 60 + #php_admin_value upload_max_filesize 8M + #php_admin_flag allow_url_fopen Off + #php_value default_charset ISO-8859-15 + php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f matomo" + php_admin_value open_basedir "/usr/share/php:/home/matomo:/tmp" + +~~~ + +## Du chiffrement + +On utilise certbot pour mettre du Let's Encrypt qui nous délivrera des certificats SSL : + +~~~ +certbot certonly --webroot --webroot-path /var/lib/letsencrypt -d domaine-matomo-instance.com +~~~ + +## Déployer l'application + +Se connecter avec le compte UNIX et télécharger matomo et le dézipper comme ceci : + +~~~ +# su - matomo +$ wget https://builds.matomo.org/matomo.zip && unzip matomo.zip +$ mv -i matomo www +~~~ + +Il reste à suivre les instructions de son installation via https://domaine-matomo-instance.com + +### Forcer le SSL + +Pour augmenter d'un cran le niveau de sécurité, on ajoute dans `/home/matomo/www/config/config.ini.php` ces directives : + +~~~ +[General] +force_ssl = 1 +~~~ + +### Activer l'archivage + +Désactiver l'archivage via l'interface web dans : *administration (roue cranté)* -> *Système* -> *paramètres généraux* -> *Paramètres d'archivage* -> mettre sur *Non* + +Puis ajouter cette tâche dans la crontab de l'utilisateur : + +~~~ +MAITO="foo@bar.com" +30 * * * * /usr/bin/php /home/matomo/www/console core:archive --url=https://domaine-matomo-instance.com +~~~ \ No newline at end of file