GNU/Linux >> Tutoriels Linux >  >> Debian

Installer Matomo Web Analytics sur Debian 11 avec Apache et Let’s Encrypt

Matomo, anciennement Piwik, est une plateforme libre d’analyse web. Elle fournit des statistiques détaillées sur les visiteurs, les mots-clés, les pages consultées, les téléchargements et le suivi publicitaire. Une API de suivi et de reporting est également disponible.

Prérequis

  • Un serveur Debian 11.
  • Un nom de domaine pointant vers le serveur.
  • Un accès root.

1. Installer Apache, MariaDB et PHP

apt-get install apache2 mariadb-server php libapache2-mod-php php-cli php-fpm php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath curl unzip -y
systemctl start apache2 mariadb
systemctl enable apache2 mariadb

2. Créer la base de données

mysql
CREATE DATABASE matomodb;
CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON matomodb.* TO 'matomo'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

3. Télécharger Matomo

wget https://builds.matomo.org/matomo-latest.zip
unzip matomo-latest.zip
mv matomo /var/www/html/matomo
chown -R www-data:www-data /var/www/html/matomo
chmod -R 755 /var/www/html/matomo

4. Configurer Apache

Créez un hôte virtuel avec DocumentRoot vers /var/www/html/matomo/, activez AllowOverride All et bloquez l’accès direct aux répertoires sensibles comme console, misc et vendor.

a2ensite matomo.conf
a2enmod rewrite
systemctl restart apache2

5. Lancer l’installateur web

Ouvrez https://matomo.example.com, puis suivez les étapes : vérification PHP, configuration de la base, création du super utilisateur, ajout du site et récupération du code de suivi JavaScript.

6. Ajouter un certificat Let’s Encrypt

apt-get install certbot python3-certbot-apache -y
certbot --apache -d matomo.example.com

Certbot installe le certificat et redirige automatiquement le trafic HTTP vers HTTPS. Une fois le code de suivi ajouté à vos pages, Matomo commence à collecter les statistiques.

Debian
  1. Installer MariaDB 10.x sur Debian 11 et le sécuriser

  2. Installer Matomo Web Analytics sur Ubuntu 20.04

  3. Installer Open Web Analytics sur Debian 9

  4. Installer Fathom Analytics sur Debian 11

  5. Installer MariaDB sur Debian 11 et le sécuriser

Installer Matomo Web Analytics sur Ubuntu 18.04 LTS

Installer MariaDB 10.6 sur Debian 11

Installer MariaDB sur Debian 8

Installer Nextcloud sur Debian 8

Installer OwnCloud sur Debian 9

Comment installer Matomo sur Debian 9 Stretch