halo 配置umami (halo 2.3.0)

编辑 / blog / 发布于2023-03-19 / 更新于2023-03-19 / 阅读 200

安装umami

创建 docker-compose.yml 填入

---
version: '3'
services:
  umami:
    image: ghcr.io/umami-software/umami:postgresql-latest
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgresql://umami:umami@db:5432/umami
      DATABASE_TYPE: postgresql
      HASH_SALT: replace-me-with-a-random-string
    depends_on:
      - db
    restart: always
  db:
    image: postgres:12-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: umami
    volumes:
      - ./sql/schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
      - umami-db-data:/var/lib/postgresql/data
    restart: always
volumes:
  umami-db-data:

启动umami docker

 docker-compose up -d

caddy反代umami

反代配置文件 注意替换域名 umami.domain 改成umami的域名,blog.domain改成你的博客域名

umami.domain {
	reverse_proxy localhost:3000 {
		header_down Content-Security-Policy "frame-ancestors blog.domain"
		header_down x-frame-options "ALLOW-FROM blog.domain"
	}
}

halo配置umami

点击 插件-umami-设置 ,配置umami