软件:matomo

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
软件:matomo [2025/10/04 15:57] admin软件:matomo [2025/10/06 23:02] (当前版本) admin
行 1: 行 1:
-Matomo是一个开源的网站分析平台+Matomo是一个开源的网站页面流量统计与分析平台
  
-[[https://builds.matomo.org]]+[[https://matomo.org]]
  
-下载+下载,将 zip 文件解压缩到硬盘驱动器上的文件夹中。这将创建一个包含文件和目录的“matomo”文件夹。
  
 <code -> <code ->
行 21: 行 21:
  
 <code -> <code ->
-#创建sql 
 #连接到您的 MySQL 数据库 #连接到您的 MySQL 数据库
 mysql -u root -p mysql -u root -p
 输入密码,后enter 输入密码,后enter
 #为 Matomo 创建数据库: #为 Matomo 创建数据库:
-$ mysql> CREATE DATABASE matomo_db_name_here+CREATE DATABASE matomo_db
-如果您使用的是 MySQL 5.7 或 MySQL 8 或更高版本,请创建一个名为 的用户:matomo +#显示数据库 
- +SHOW DATABASES; 
-$ mysql> CREATE USER 'matomo'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my-strong-password-here'+#权限 
-予此用户访问数据库的权限matomomatomo_db_name_here +#创建其他用户 
-$ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON matomo_db_name_here.* TO 'matomo'@'localhost'+CREATE USER admin IDENTIFIED BY "********"
-(可选)授予此用户 FILE 全局权限:(如果启用由于 LOAD DATA INFILE 功能,报告存档速度将更快)matomo +#WordPress权限权给admin用户 
-mysql> GRANT FILE ON *.* TO 'matomo'@'localhost';+GRANT ALL PRIVILEGES ON matomo_db.* TO admin
 +#系统会重新加载权限确保使用是最新的权限设置。 
 +FLUSH PRIVILEGES; 
 +#退出mysql数据库 
 +EXIT;
 </code> </code>
  
 服务器配置 服务器配置
  
-<code -> +<code nginx matomo.conf>
-Nginx +
-cd /etc/nginx/conf.d/ +
-server { +
-    listen [::]:80; # remove this if you don't want Matomo to be reachable from IPv6 +
-    listen 80; +
-    server_name matomo.example.com; +
-    # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response. +
-    location / { +
-        return 301 https://$host$request_uri; +
-    } +
-}+
 server { server {
-    listen [::]:443 ssl http2; # remove this if you don't want Matomo to be reachable from IPv6 +    listen [::]:4433 ssl http2; # remove this if you don't want Matomo to be reachable from IPv6 
-    listen 443 ssl http2; +    listen 4433 ssl http2; 
-    server_name matomo.example.com; # list all domains Matomo should be reachable from+    server_name matomo.localhost; # list all domains Matomo should be reachable from
     access_log /var/log/nginx/matomo.access.log;     access_log /var/log/nginx/matomo.access.log;
     error_log /var/log/nginx/matomo.error.log;     error_log /var/log/nginx/matomo.error.log;
行 62: 行 54:
  
     ## replace with your SSL certificate     ## replace with your SSL certificate
-    ssl_certificate /etc/letsencrypt/live/matomo.example.com/fullchain.pem; +    ssl_certificate     /etc/nginx/conf.d/cert/localhost.pem; 
-    ssl_certificate_key /etc/letsencrypt/live/matomo.example.com/privkey.pem;+    ssl_certificate_key /etc/nginx/conf.d/cert/localhost.key;
  
-    include ssl.conf; # if you want to support older browsers, please read through this file+    include ssl.conf; # if you want to support older browsers, please read through this file 
 +    # ssl_session_timeout 1d; 
 +    # ssl_session_cache shared:SSL:50m; 
 +    # ssl_session_tickets off; 
 +    # modern configuration. tweak to your needs. 
 +    # ssl_protocols TLSv1.2; 
 +    # ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; 
 +    # ssl_prefer_server_ciphers on; 
 +    # OCSP Stapling --- 
 +    # fetch OCSP records from URL in ssl_certificate and cache them 
 +    ssl_stapling on; 
 +    ssl_stapling_verify on;
  
     add_header Referrer-Policy origin always; # make sure outgoing links don't show the URL to the Matomo instance     add_header Referrer-Policy origin always; # make sure outgoing links don't show the URL to the Matomo instance
行 80: 行 83:
         try_files $fastcgi_script_name =404; # protects against CVE-2019-11043. If this line is already included in your snippets/fastcgi-php.conf you can comment it here.         try_files $fastcgi_script_name =404; # protects against CVE-2019-11043. If this line is already included in your snippets/fastcgi-php.conf you can comment it here.
         fastcgi_param HTTP_PROXY ""; # prohibit httpoxy: https://httpoxy.org/         fastcgi_param HTTP_PROXY ""; # prohibit httpoxy: https://httpoxy.org/
-        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #replace with the path to your PHP socket file+        fastcgi_pass unix:/run/php/php8.2-fpm.sock; #replace with the path to your PHP socket file
         #fastcgi_pass 127.0.0.1:9000; # uncomment if you are using PHP via TCP sockets (e.g. Docker container)         #fastcgi_pass 127.0.0.1:9000; # uncomment if you are using PHP via TCP sockets (e.g. Docker container)
     }     }
行 131: 行 134:
 } }
 # vim: filetype=nginx # vim: filetype=nginx
 +</code>
  
 +添加Nginx规则
  
 +<code ->
 +cd /etc/nginx/conf.d/
 +#粘贴Nginx配置matomo.conf
 #查看nginx的配置文件路径,记录nginx.conf路径 #查看nginx的配置文件路径,记录nginx.conf路径
 nginx -t nginx -t
 sudo systemctl restart nginx sudo systemctl restart nginx
-chown -R www-data:www-data /var/www/matomo 
 </code> </code>
  
-将 zip 文件解压缩到硬盘驱动上的文件夹中。这将创建一个包含文件和目录的“matomo”文件夹。 +浏览访问
- +
-打开您的 FTP 客户端并将 Matomo 文件以“二进制模式”上传到 Web 服务器上的所需位置。例如,使用 Filezilla FTP 客户端,您可以在顶部菜单中启用二进制模式传输 传输 >传输类型 >二进制)。所有文件都可以上传到公共 www 文件夹中的“分析”子目录,例如 [[http://yourdomain.org/analytics/]],或者您可以在自己的子域中设置 Matomo 并在 [[http://analytics.example.org/]] 上传所有文件+
  
 欢迎屏幕 欢迎屏幕
行 149: 行 154:
 安装 JavaScript 跟踪标记 安装 JavaScript 跟踪标记
  
-在您要分析的每个页面上安装 Matomo 生成的 JavaScript 跟踪标签。我们建议将此代码放在结束标记之前或包含在所有页面顶部的共享头文件中</head>+在您要分析的每个页面上安装 Matomo 生成的 JavaScript 跟踪标签。建议将此代码放在结束标记之前或包含在所有页面顶部的共享头文件中</head
 + 
 +<code -> 
 +vi /var/www/dokuwiki/lib/tpl/bootstrap3/main.php 
 + 
 +<head>... 
 + 
 +<!-- Matomo --> 
 +<script> 
 +  var _paq = window._paq = window._paq || []; 
 +  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ 
 +  _paq.push(['trackPageView']); 
 +  _paq.push(['enableLinkTracking']); 
 +  (function() { 
 +    var u="//localhost/"; 
 +    _paq.push(['setTrackerUrl', u+'matomo.php']); 
 +    _paq.push(['setSiteId', '1']); 
 +    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; 
 +    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); 
 +  })(); 
 +</script> 
 +<!-- End Matomo Code --> 
 + 
 +</head> 
 +</code>
  
  
  • 软件/matomo.1759564633.txt.gz
  • 最后更改: 2025/10/04 15:57
  • admin