Metainformationen zur Seite
Dies ist eine alte Version des Dokuments!
matomo
Installation
Die folgende Konfiguration legt eine mariadb, die app und das Webinterface unter nginx an. Die matomo Konfiguration liegt dann unter:
/var/lib/docker/volumes/matomo_matomo/_data/config/config.ini.php
Im Verzeichnis /home/cs/matomo drei Dateien anlegen.
++++ docker-compose.yaml |
- docker-compose.yaml
version: "3" services: db: image: mariadb:10.11 command: --max-allowed-packet=64MB restart: always volumes: - db:/var/lib/mysql:Z environment: - MYSQL_ROOT_PASSWORD=uhpc49C5+# - MARIADB_AUTO_UPGRADE=1 - MARIADB_DISABLE_UPGRADE_BACKUP=1 env_file: - ./db.env app: image: matomo:fpm-alpine restart: always links: - db volumes: # - ./config:/var/www/html/config:z # - ./logs:/var/www/html/logs:z - matomo:/var/www/html:z environment: - MATOMO_DATABASE_HOST=db - PHP_MEMORY_LIMIT=2048M env_file: - ./db.env web: image: nginx:alpine restart: always volumes: - matomo:/var/www/html:z,ro # see https://github.com/matomo-org/matomo-nginx - ./matomo.conf:/etc/nginx/conf.d/default.conf:z,ro ports: - 8083:80 volumes: db: matomo:
++++
++++ db.env |
- db.env
MYSQL_PASSWORD=uhpc49C5+# MYSQL_DATABASE=matomo MYSQL_USER=cs MATOMO_DATABASE_ADAPTER=mysql MATOMO_DATABASE_TABLES_PREFIX=matomo_ MATOMO_DATABASE_USERNAME=cs MATOMO_DATABASE_PASSWORD=uhpc49C5+# MATOMO_DATABASE_DBNAME=matomo MARIADB_AUTO_UPGRADE=1 MARIADB_INITDB_SKIP_TZINFO=1
++++
++++ matomo.conf |
- matomo.conf
upstream php-handler { server app:9000; } server { listen 80; add_header Referrer-Policy origin; # make sure outgoing links don't show the URL to the Matomo instance root /var/www/html; # replace with path to your matomo instance index index.php; try_files $uri $uri/ =404; ## only allow accessing the following php files location ~ ^/(index|matomo|piwik|js/index|plugins/HeatmapSessionRecording/configs).php { # regex to split $uri to $fastcgi_script_name and $fastcgi_path fastcgi_split_path_info ^(.+\.php)(/.+)$; # Check that the PHP script exists before passing it try_files $fastcgi_script_name =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTP_PROXY ""; # prohibit httpoxy: https://httpoxy.org/ fastcgi_pass php-handler; } ## deny access to all other .php files location ~* ^.+\.php$ { deny all; return 403; } ## disable all access to the following directories location ~ /(config|tmp|core|lang) { deny all; return 403; # replace with 404 to not show these directories exist } location ~ /\.ht { deny all; return 403; } location ~ js/container_.*_preview\.js$ { expires off; add_header Cache-Control 'private, no-cache, no-store'; } location ~ \.(gif|ico|jpg|png|svg|js|css|htm|html|mp3|mp4|wav|ogg|avi|ttf|eot|woff|woff2|json)$ { allow all; ## Cache images,CSS,JS and webfonts for an hour ## Increasing the duration may improve the load-time, but may cause old files to show after an Matomo upgrade expires 1h; add_header Pragma public; add_header Cache-Control "public"; } location ~ /(libs|vendor|plugins|misc/user) { deny all; return 403; } ## properly display textfiles in root directory location ~/(.*\.md|LEGALNOTICE|LICENSE) { default_type text/plain; } } # vim: filetype=nginx
++++