前端埋点matomo详细安装配置(⼀)安装Matomo
安装环境准备nginx部署前端项目
1. PHP环境(⾼于PHP5.5),
2. 安装MySQL,并创建数据库
3. Nginx,
开始安装
选择内部安装,下载matomo
下载地址:
将下载的安装包解压
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:l
-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:
-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 /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 f
-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 pes
-rw-r--r-- 1 app app 728 Mar 2 11:f
-rw-r--r-- 1 app app 4501 Mar 1 15:f.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、f 配置,配置如下:
#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 pes;
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$f
server {
listen 9530 default_server;
server_name _;
root /home/app/matomo;
include /home/app/nginx-1.9.9/f;
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/f syntax is ok nginx: configuration file /home/app/nginx-1.9.9/f 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 跟踪代码
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论