Notes : ce domaine hébergera l'outil Matomo permettant d'analyser l'utilisation des sites web du SINP (Wordpress, GeoNature…). Il est embarqué dans un container Docker et fait partie de la stack analytics.silene.eu.
vi /etc/nginx/sites-available/analytics.conf
server { listen 80; listen [::]:80; server_name analytics.silene.eu; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $realip_remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:50083/;# ATTENTION : bien mettre un slash final ! Sinon => erreur 404 } }
cd /etc/nginx/sites-enabled/ ; ln -s ../sites-available/analytics.conf analytics.conf
nginx-reload
ou nginx -t && nginx -s reload
http://analytics.<domaine-sinp>/
qui doit afficher une erreur 502 car nous n'avons pas encore lancé le container Docker.docker network ls
cd ~/docker/analytics.<domaine-sinp>
docker-compose up
https://analytics.<domaine-sinp>/
(se loguer avec le compte root Mysql)CTRL+C
docker-compose up -d
docker compose down
certbot --nginx -d analytics.<domaine-sinp>
certbot --nginx -d analytics.silene.eu
certbot --nginx -d analytics.biodiversite-aura.net
server { listen 443 ssl http2; # managed by Certbot listen [::]:443 ssl http2; # managed by Certbot server_name analytics.silene.eu; location / { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $realip_remote_addr; proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:50083/;# ATTENTION : bien mettre un slash final ! Sinon => erreur 404 } ssl_certificate /etc/letsencrypt/live/analytics.silene.eu/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/analytics.silene.eu/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { listen 80; listen [::]:80; server_name analytics.silene.eu; return 302 https://analytics.silene.eu$request_uri; }
docker cp analytics-matomo:/var/www/html/config/config.ini.php ~/docker/analytics.silene.eu/matomo/config/
[General] force_ssl = 1
docker cp ~/docker/analytics.silene.eu/matomo/config/config.ini.php analytics-matomo:/var/www/html/config/config.ini.php
docker exec -it analytics-matomo /bin/bash
cd /var/www/html/config
chown www-data:www-data config.ini.php
docker exec -it analytics-matomo /bin/bash
cd /var/www/html/
./console core:test-email test@mon-domaine.ext
docker-compose up -d --no-deps --build analytics-matomo
analytics-nginx
/var/www/html/tmp/templates_c/
appartient bien à l'utilisateur www-data