前端埋点 matomo 详细安装配置 (一)

18 篇文章 0 订阅
13 篇文章 0 订阅

安装Matomo

安装环境准备

  1. PHP环境(高于PHP5.5),PHP安装参考
  2. 安装MySQL,并创建数据库 MySQL安装参考
  3. Nginx,Nginx安装参考

开始安装

将下载的安装包解压

app@matomo:~/matomo$unzip matomo-latest.zip
app@matomo:~/matomo$cd matomo
app@matomo:~/matomo$pwd
/home/app/matomo
app@matomo:~/matomo$ll
total 372
-rw-r--r--  1 app app 91629 Feb 22 12:31 CHANGELOG.md
drwxr-xr-x  3 app app   122 Mar  1 15:57 config
-rwxr-xr-x  1 app app   753 Feb 22 12:31 console
-rw-r--r--  1 app app   929 Feb 22 12:31 CONTRIBUTING.md
drwxr-xr-x 51 app app  4096 Mar  1 15:51 core
-rw-r--r--  1 app app   578 Feb 22 12:31 DIObject.php
-rw-r--r--  1 app app     0 Mar  1 15:49 favicon.ico
-rw-r--r--  1 app app   712 Feb 22 12:31 index.php
drwxr-xr-x  2 app app   124 Mar  1 15:51 js
drwxr-xr-x  2 app app  4096 Mar  1 15:51 lang
-rw-r--r--  1 app app   828 Feb 22 12:31 LegacyAutoloader.php
-rw-r--r--  1 app app  8620 Feb 22 12:31 LEGALNOTICE
drwxr-xr-x  9 app app   148 Mar  1 15:51 libs
-rw-r--r--  1 app app 35146 Feb 22 12:31 LICENSE
-rw-r--r--  1 app app 61889 Feb 22 12:31 matomo.js
-rw-r--r--  1 app app   328 Feb 22 12:31 matomo.php
drwxr-xr-x  8 app app  4096 Mar  5 10:43 misc
drwxr-xr-x 21 app app  4096 Mar  1 15:51 node_modules
-rw-r--r--  1 app app  6381 Feb 22 12:31 offline-service-worker.js
-rw-r--r--  1 app app  4601 Feb 22 12:31 package-lock.json
-rw-r--r--  1 app app  1365 Feb 22 12:31 phpcs.xml
-rw-r--r--  1 app app 61889 Feb 22 12:31 piwik.js
-rw-r--r--  1 app app  2685 Feb 22 12:31 piwik.php
drwxr-xr-x 69 app app  4096 Mar  1 15:51 plugins
-rw-r--r--  1 app app  4617 Feb 22 12:31 PRIVACY.md
-rw-r--r--  1 app app  5688 Feb 22 12:31 README.md
-rw-r--r--  1 app app   744 Feb 22 12:31 robots.txt
-rw-r--r--  1 app app  1870 Feb 22 12:31 SECURITY.md
drwxr-xr-x  2 app app    22 Feb 22 12:32 tests
drwxr-xr-x 10 app app  4096 Mar  1 15:51 tmp
drwxr-xr-x 22 app app  4096 Mar  1 15:51 vendor

  • 如果服务器能连外网也可以直接使用
wget https://builds.matomo.org/matomo.zip && unzip matomo.zip

Nginx 配置matomo

  • 1、进入Nginx conf 目录
app@matomo:~/nginx-1.9.9/conf$pwd
/home/app/nginx-1.9.9/conf
app@matomo:~/nginx-1.9.9/conf$ll
total 44
-rw-r--r-- 1 app app 1077 Dec  9  2015 fastcgi.conf
-rw-r--r-- 1 app app 1007 Dec  9  2015 fastcgi_params
-rw-r--r-- 1 app app 2837 Dec  9  2015 koi-utf
-rw-r--r-- 1 app app 2223 Dec  9  2015 koi-win
-rw-r--r-- 1 app app 3957 Dec  9  2015 mime.types
-rw-r--r-- 1 app app  728 Mar  2 11:28 nginx.conf
-rw-r--r-- 1 app app 4501 Mar  1 15:03 nginx.conf.back
-rw-r--r-- 1 app app  636 Dec  9  2015 scgi_params
-rw-r--r-- 1 app app  664 Dec  9  2015 uwsgi_params
drwxrwxr-x 2 app app  123 Mar  4 10:13 vhost
-rw-r--r-- 1 app app 3610 Dec  9  2015 win-utf

  • 2、ngin.conf 配置,配置如下:
#user  nobody;
worker_processes  10;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    underscores_in_headers on;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
    include vhost/*.conf;
}
  • 3、在conf 下创建 vhost目录
app@matomo:~/nginx-1.9.9/conf$mkdir vhost
  • 4、Nginx 下配置matomo
app@matomo:~/nginx-1.9.9/conf/vhost$vim 9530.conf
server {
        listen       9530 default_server;
        server_name  _;
        root         /home/app/matomo;
        include /home/app/nginx-1.9.9/conf/fastcgi.conf;
        location / {
                try_files $uri /index.php$is_args$args;
        }

        location ~ \.php$ {
              #  try_files $uri =404;
                include fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
 }

  • 5、测试配置
    successful 表示配置没问题
app@matomo:~/nginx-1.9.9/conf/vhost$../../sbin/nginx -t
nginx: the configuration file /home/app/nginx-1.9.9/conf/nginx.conf syntax is ok
nginx: configuration file /home/app/nginx-1.9.9/conf/nginx.conf test is successful
  • 6、生效配置
app@matomo:~/nginx-1.9.9/conf/vhost$../../sbin/nginx -s reload
  • 7、测试matomo
    host:prot 访问matomo
    在这里插入图片描述
    注意:
    若不生效则重启Nginx,命令如下:
nginx -s stop
nginx -s start

初始化配置matomo

  • 选择语言
    在这里插入图片描述
  • 系统检查下一步到数据库设置
    配置提前创建好的MySQL数据库
    在这里插入图片描述
    在这里插入图片描述
  • 设置超级用户
    在这里插入图片描述
  • 设置网站
  • 设置 JavaScript 跟踪代码
    在这里插入图片描述
  • 完成设置使用matomo
    在这里插入图片描述
  • 异常
    在这里插入图片描述
    如果不是使用80 端口需要在piwik/config/config.ini.php 设置trusted_hosts[] = “ip:prot”
app@matomo:~/matomo$cd config/
app@matomo:~/matomo/config$ls
config.ini.php  environment  global.ini.php  global.php  manifest.inc.php
app@matomo:~/matomo/config$pwd
/home/app//matomo/config
app@matomo:~/matomo-test/matomo/config$vim config.ini.php 

在这里插入图片描述
刷新页面即可
在这里插入图片描述

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值