一、环境准备
#安装nginx服务,php服务,数据库服务
[root@web01 ~]# yum install -y nginx php-fpm mariadb-server
#编写nginx配置文件
[root@web01 /etc/nginx/conf.d]# cat matomo.conf
server {
listen 80;
server_name www.matomo.com;
location / {
root /usr/share/nginx/html/matomo;
index index.php index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/html/matomo;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
#重启服务
[root@web01 ~]# systemctl restart nginx.service php-fpm.service mariadb.service
二、部署matomo
#上传matomo-latest.zip代码包
[root@web01 ~]# cd /usr/share/nginx/html/
[root@web01 /usr/share/nginx/html]# ls
matomo-latest.zip
#解压
[root@web01 /usr/share/nginx/html]# unzip -q /root/matomo-latest.zip -d ./
#授权
[root@web01 /usr/share/nginx/html]# chown -R nginx.nginx matomo/
[root@web01 /usr/share/nginx/html]# ll
-rw-r--r-- 1 root root 341 3月 24 12:25 How to install Matomo.html
drwxr-xr-x 12 nginx nginx 4096 5月 22 15:16 matomo
-rw-r--r-- 1 root root 19375918 5月 22 14:42 matomo-latest.zip
#创建数据库及用户
[root@web01 ~]# mysql -uroot -p
MariaDB [(none)]> create database matomo;
MariaDB [(none)]> grant all on matomo.* to matomo@'localhost' identified by '123456';
三、浏览器页面部署安装matomo
1.浏览器输入域名访问(需要域名解析)
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/202005221049257.png)
2.下一步安装
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210492671.png)
3.填写数据库信息
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210492717.png)
4.数据库验证成功
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210492889.png)
5.设置登录用户及密码
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210492971.png)
6.设置网站信息
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210492981.png)
7.下一步完成安装
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210493145.png)
8.继续使用matomo
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210493123.png)
四、使用matomo分析网站数据
1.登录matomo
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210493275.png)
2.复制js代码
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210493366.png)
3.粘贴到网站的第三方统计代码中
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210493444.png)
4.在matomo报表面板中查看数据
![搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】 搭建一个属于自己的网站统计分析站点 – Matomo【显哥出品,必为精品】](https://www.lixian.fun/wp-content/uploads/2020/05/2020052210493671.png)