安装Matomo
安装环境准备
PHP环境(高于PHP5.5),PHP安装参考
安装MySQL,并创建数据库 MySQL安装参考
Nginx,Nginx安装参考
开始安装
选择内部安装,下载matomo
下载地址:https://matomo.org/download/
将下载的安装包解压
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
如果服务器能连外网也可以直接使用
wget https://builds.matomo.org/matomo.zip && unzip matomo.zip
1
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
3、在conf 下创建 vhost目录
app@matomo:~/nginx-1.9.9/conf$mkdir vhost
1
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;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
1
2
3
6、生效配置
app@matomo:~/nginx-1.9.9/conf/vhost$../../sbin/nginx -s reload
1
7、测试matomo
host:prot 访问matomo
注意:
若不生效则重启Nginx,命令如下:
nginx -s stop
nginx -s start
1
2
初始化配置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