Matomo Docker Compose 项目教程
compose-matomoMatomo docker-compose application for libre.sh-v1项目地址:https://gitcode.com/gh_mirrors/co/compose-matomo
项目的目录结构及介绍
Matomo Docker Compose 项目的目录结构如下:
compose-matomo/
├── docker-compose.yml
├── db.env
├── matomo.conf
└── README.md
目录结构介绍
docker-compose.yml
: 定义了 Docker Compose 的服务配置。db.env
: 包含数据库的环境变量配置。matomo.conf
: Nginx 的配置文件。README.md
: 项目的说明文档。
项目的启动文件介绍
docker-compose.yml
docker-compose.yml
文件是 Docker Compose 的核心配置文件,定义了项目的各个服务及其配置。以下是该文件的主要内容:
version: '3'
services:
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: matomo
MYSQL_USER: matomo
MYSQL_PASSWORD: matomo
volumes:
- db:/var/lib/mysql
app:
image: matomo
depends_on:
- db
environment:
MATOMO_DATABASE_ADAPTER: mysql
MATOMO_DATABASE_HOST: db
MATOMO_DATABASE_PORT: 3306
MATOMO_DATABASE_TABLES_PREFIX: matomo_
MATOMO_DATABASE_USERNAME: matomo
MATOMO_DATABASE_PASSWORD: matomo
MATOMO_DATABASE_DBNAME: matomo
volumes:
- matomo:/var/www/html
web:
image: nginx
depends_on:
- app
ports:
- "8085:80"
volumes:
- ./matomo.conf:/etc/nginx/conf.d/default.conf
- matomo:/var/www/html
volumes:
db:
matomo:
启动步骤
-
克隆项目仓库:
git clone https://github.com/libresh/compose-matomo.git
cd compose-matomo
-
启动服务:
docker-compose up -d
-
访问 Matomo:
http://<your-domain>:8085
项目的配置文件介绍
db.env
db.env
文件包含了数据库的环境变量配置,内容如下:
MYSQL_PASSWORD=matomo
MYSQL_DATABASE=matomo
MYSQL_USER=matomo
MATOMO_DATABASE_ADAPTER=mysql
MATOMO_DATABASE_TABLES_PREFIX=matomo_
MATOMO_DATABASE_USERNAME=matomo
MATOMO_DATABASE_PASSWORD=matomo
MATOMO_DATABASE_DBNAME=matomo
matomo.conf
matomo.conf
文件是 Nginx 的配置文件,内容如下:
upstream php-handler {
server app:9000;
}
server {
listen 80;
client_header_timeout 1000000;
client_body_timeout 1000000;
send_timeout 1000000;
fastcgi_read_timeout 1000000;
add_header Referrer-Policy origin;
root /var/www/html;
index index.php;
try_files $uri $uri/ =404;
location ~ .php$ {
fastcgi_pass php-handler;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /(libs|vendor|plugins|misc/user) {
deny all;
return 403;
}
location ~ /(.*.md|LEGALNOTICE|LICENSE) {
default_type text/plain;
}
}
以上是 Matomo Docker Compose 项目的详细教程,包括项目的目录结构、启动文件和配置文件的介绍
compose-matomoMatomo docker-compose application for libre.sh-v1项目地址:https://gitcode.com/gh_mirrors/co/compose-matomo