Docker项目:搭建服务器流量监控
拉取Docker镜像,国内的小伙伴下载可能很慢
docker pull ghcr.io/umami-software/umami:postgresql-latest &&
docker pull postgres:12-alpine
编辑umami文件下的Docker-compose.yml文件
---
version: '3'
services:
app:
image: ghcr.io/mikecao/umami:postgresql-latest
ports:
- "3000:3000" # 按需修改
environment:
# DATABASE_URL: postgresql://POSTGRES_USER:POSTGRES_PASSWORD@db:5432/POSTGRES_DB
# 按实际情况修改
DATABASE_URL: postgresql://umami:umamipassword@db:5432/umami # 按下面的信息修改
DATABASE_TYPE: postgresql
HASH_SALT: replace-me-with-a-random-string
depends_on:
- db
restart: always
networks:
- default
db:
image: postgres:12-alpine
environment:
POSTGRES_DB: umami # 数据库名,不建议改
POSTGRES_USER: umami # 数据库用户,不建议改
POSTGRES_PASSWORD: umamipassword # 数据库密码 按需修改
volumes:
- ./sql/schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
- ./data:/var/lib/postgresql/data
restart: always
networks:
- default
networks:
default:
name: umami
上线服务
docker-compose up -d
反向代理配置
location / {
proxy_pass http://127.0.0.1:3000/;
rewrite ^/(.*)$ /$1 break;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade-Insecure-Requests 1;
proxy_set_header X-Forwarded-Proto https;
}
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果