ntfy配置

_

docker compose

services:
  ntfy:
    image: "binwiederhier/ntfy"
    container_name: ${CONTAINER_NAME}
    command:
      - serve
    environment:
      - TZ=${TIME_ZONE}
      - NTFY_BASE_URL=<ntfy url>
      - NTFY_CACHE_FILE=/var/cache/ntfy/cache.db
      - NTFY_ATTACHMENT_CACHE_DIR=/var/cache/ntfy/attachments
      - NTFY_AUTH_FILE=/var/lib/ntfy/auth.db
      - NTFY_AUTH_DEFAULT_ACCESS=deny-all
      - NTFY_BEHIND_PROXY=true
      - NTFY_ENABLE_LOGIN=true
    volumes:
      - ./data/cache:/var/cache/ntfy
      - ./data/etc:/etc/ntfy
      - ./data/lib:/var/lib/ntfy
    ports:
      - "${PANEL_APP_PORT_HTTP}:${APP_PORT_INTERNAL}"
    restart: always
    networks:
      - 1panel-network
    healthcheck:
        test: ["CMD-SHELL", "wget -q --tries=1 http://localhost:${APP_PORT_INTERNAL}/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"]
        interval: 60s
        timeout: 10s
        retries: 3
        start_period: 40s
    labels:
      createdBy: "Apps"
networks:
  1panel-network:
    external: true

推荐配置

base-url: "http://<url>"
listen-http: ":80"
cache-file: "/var/cache/ntfy/cache.db"
auth-file: "/var/lib/ntfy/user.db"
auth-default-access: "deny-all"
behind-proxy: true

attachment-cache-dir: "/var/cache/ntfy/attachments"
attachment-total-size-limit: "5G"
attachment-file-size-limit: "1G"
attachment-expiry-duration: "24h"

upstream-base-url: "https://ntfy.sh"

用户管理

ntfy user list                           # 列出所有user
ntfy user add <username>                 # 添加普通用户<username>
ntfy user add --role=admin <username>    # 添加管理员<username>
ntfy user del <username>                 # 删除用户<username>
ntfy user change-pass <username>         # 改变用户<username>的密码
ntfy user change-role <username> admin   # Make <username> an admin
ntfy user change-tier <username> pro     # Change <username> tier to "pro"

权限管理

ntfy access                              # Shows entire access control list
ntfy access <username>                   # 查询<username>的权限
ntfy access <username> <topic> rw        # 赋予<username>对<topic>的<qw>权限
ntfy access everyone <topic> read        # 赋予所有人对<topic>的查看权限
ntfy access --reset                      # 重置所有的权限
ntfy access --reset <username>           # 重置用户<username>的所有权限
ntfy access --reset <topic>              # 重置<topic>的权限


ntfy token list                            # 查询所有的token
ntfy token list <username>                 # 查询<username>的token
ntfy token add <username>                  # 创建<username>的token
ntfy token add --expires=2d <username>     # 创建<username>的2天有效的token
ntfy token remove <username> <token name>  # 移除<username>的token

可选参数
--expires=30d    # 30天后过期
--label          # token的备注

AutoBangumi 2025-04-26
Plink使用帮助 2025-09-28