一款谷歌Google Analytics的替代品-Umami
一款谷歌Google Analytics的替代品-Umami
简单,非常轻量级,没有跟踪器,免费,开源
下面是Umami的安装教程
安装docker
1
2
3
4
5
apt-get update
apt-get install git curl
sudo curl -sS https://get.docker.com/ | sh
curl -L https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
1
2
sudo systemctl start docker. //启动docker
sudo systemctl enable docker //开机启动docker
1
2
3
git clone https://github.com/mikecao/umami.git
cd umami/
//拉取Umami镜像
修改docker-compose.yml配置文件,根据自己的实际情况修改
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
version: '3'
services:
umami:
image: ghcr.io/mikecao/umami:postgresql-latest
ports:
- "127.0.0.1:3000:3000" # 监听在本地3000端口
environment:
DATABASE_URL: postgresql://username:datapassword@db-umami:5432/umami
DATABASE_TYPE: postgresql
HASH_SALT: replace-me-with-a-random-string
depends_on:
- db-umami
db-umami:
image: postgres:12-alpine
environment:
POSTGRES_DB: umami
POSTGRES_USER: username # 数据库用户
POSTGRES_PASSWORD: datapassword # 数据库密码
volumes:
- ./sql/schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
- umami-db-data:/var/lib/postgresql/data
volumes:
umami-db-data:
跑起来,加上-d 后台运行
docker-compose up -d
添加下面代码到nginx虚拟机的配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
server {
listen 80;
server_name demodomin; #您的域名
client_max_body_size 0;
location ~ / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
lsof -i:3000
查看Umami是否运行
访问你的域名,输入用户名admin,密码umami即可
添加域名,把统计代码添加到网站页脚即可~