Matomo搭建一个属于自己的网站统计分析站点
本文介绍matomo(前身Pwiki)的本地搭建过程。matomo作为前端页面的日志统计工具,对一些网站的监控还是很有必要的。
-
-
nginx代理 (选用 nginx 1.6.3)
-
IP地址 | 服务 | |
web01 | 10.0.0.7 | wordpress |
web02 | 10.0.0.8 |
vim /etc/yum.repos.d/nginx.repo --官方源 [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key [root@web01 ~]# yum install nginx -y
server { listen 80; server_name blog.oldboy.com; client_max_body_size 100m; location / { root /html; index index.php index.html index.htm; } location ~ \.php$ { root /html; 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 ~]# mkdir /html [root@web01 ~]# cd /html [root@web01 /html]# wget https://builds.matomo.org/matomo.zip --下载matomo [root@web01 /html]# unzip matomo-latest.zip [root@web01 /html]# mv matomo/* /html/ --将文件移动到/html [root@web01 /html]# chown -R nginx.nginx .
[root@web01 ~]# ls a anaconda-ks.cfg php71w.tar.gz [root@web01 ~]# cd /a [root@web01 ~/a]# yum localinstall ./*.rpm -y [root@web01 ~/a]# vim /etc/php-fpm.d/www.conf -- 修改所属主和所属组为nginx [root@web01 ~/a]# systemctl start php-fpm [root@web01 ~/a]# systemctl enable php-fpm
yum install mariadb mariadb-server -y systemctl start mariadb systemctl enable mariadb mysql #创建matomo数据库 MariaDB [(none)]> create database matomo; MariaDB [(none)]> grant all on matomo.* to matomo@'10.0.0.%' identified by '123456';
[root@web01 ~]# mkdir /html [root@web01 ~]# cd /html [root@web01 /html]# wget https://builds.matomo.org/matomo.zip --解压文件 [root@web01 /html]# chown -R nginx.nginx .
安装说明在/html
删除文件
、
rm "/html/How to install Matomo.html" "/html/matomo-latest.zip"
将网站js代码复制下来 注:代码唯一
vim /etc/yum.repos.d/nginx.repo --官方源 [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key [root@web01 ~]# yum install nginx -y
server { listen 80; server_name 10.0.0.8; client_max_body_size 100m; location / { root /html; index index.php index.html index.htm; } location ~ \.php$ { root /html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
#安装php71w.tar.gz [root@web02 ~/a]# yum localinstall ./*.rpm -y systemctl start php-fpm systemctl enable php-fpm
yum install mariadb mariadb-server -y systemctl start mariadb systemctl enable mariadb mysql
创建blog数据库
MariaDB [(none)]> create database blog; MariaDB [(none)]> grant all on blog.* to blog@'10.0.0.%' identified by '123456';
[root@web02 /html]# unzip wordpress-5.3-zh_CN.zip [root@web02 /html]# mv ./wordpress/* /html/ [root@web02 /html]# chown -R nginx.nginx . [root@web02 /html]# systemctl restart nginx
[root@web02 /html/wp-content/themes/twentyseventeen]# vim footer.php
--将代码放入</body>上面
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!