ntfy (Push Notifications via HTTP) on Debian 12

ntfy is a lightweight, open-source push notification service over HTTP that lets you send real-time notifications to mobile devices, desktops, and scripts using simple HTTP requests. Instead of depending on third-party push services, ntfy allows you to self-host your own notification server, giving you full control over topics, messages, authentication, and data privacy.

With ntfy, sending a notification can be as easy as a single curl command. This simplicity makes it ideal for system alerts, monitoring tools, CI/CD pipelines, cron jobs, automation scripts, and IoT devices.

Running ntfy on Debian 12 (Bookworm) provides a stable, secure, and long-term supported environment. Debian 12 includes systemd 252, OpenSSL 3, and mature Nginx packages, making it an excellent platform for deploying ntfy with HTTPS (SSL) in a clean, production-ready setup.


Architecture Overview

LayerComponentRole
OSDebian 12 (Bookworm)Stable, production-grade Linux base
Applicationntfy server (Go binary)Push notification service
ProtocolHTTP / WebSocketsMessage publishing and real-time delivery
Reverse ProxyNginxHTTPS termination, routing, rate limiting
TLSLet’s Encrypt / PKIEncrypted client connections
ClientsMobile, Desktop, CLI, WebSubscribe to topics and receive notifications

ntfy is distributed as a single static Go binary, which makes it extremely fast, resource-efficient, and easy to maintain.


Why Use ntfy?

  • Push notifications via simple HTTP calls
  • Fully self-hosted – no external push providers
  • Extremely lightweight – low CPU and memory usage
  • Cross-platform clients – Android, iOS, desktop, web, CLI
  • Topic-based publish/subscribe model
  • Supports WebSockets, long polling, and streaming
  • Authentication & access control – public or private topics
  • Perfect for automation and monitoring workflows

ntfy is designed for users who want reliable notifications with minimal complexity.


ntfy vs Other Notification Solutions

Feature / CapabilityntfyPushoverFirebaseGotify
HostingSelf-hostedCloud onlyCloud onlySelf-hosted
ProtocolHTTP / WebSocketAPISDK-basedHTTP
PrivacyFull controlCloud-basedCloud-basedFull control
Setup complexityVery lowLowHighMedium
ClientsMobile, desktop, CLIMobileMobileMobile / web
CostFree, open-sourcePaidFree / PaidFree

ntfy stands out for its simplicity, flexibility, and DevOps-friendly design.


Security & Best Practices on Debian 12

  • Run ntfy behind Nginx with HTTPS enabled.
  • Bind ntfy to 127.0.0.1 and expose only Nginx publicly.
  • Use TLS certificates (Let’s Encrypt recommended).
  • Enable authentication and access control for private topics.
  • Store credentials and tokens securely in config files or environment variables.
  • Use UFW or nftables to allow only ports 80 and 443.
  • Add rate limiting in Nginx to prevent abuse.
  • Keep Debian and ntfy updated regularly.
  • Manage ntfy with systemd for automatic restarts and startup on boot.

Typical Use Cases

  • Server monitoring alerts (CPU, disk, memory, downtime)
  • CI/CD pipeline notifications
  • Cron job success or failure alerts
  • Home-lab and self-hosted service monitoring
  • IoT device status notifications
  • Webhook-based automation
  • Personal push notifications without cloud services

Deploying ntfy on Debian 12 with SSL gives you a fast, secure, and fully self-hosted push notification system — ideal for automation, monitoring, and real-time alerts, without relying on third-party providers.


Step 1: Set Up a Server Instance on Shape.Host

To host ntfy, you need a reliable VPS.

Log in to your Shape.Host account at https://shape.host.

Open the dashboard and click Create.

Select Instance as the resource type.

Shape.host Resources dashboard with Create > Instance highlighted.

Choose a data center location close to your users.

Shape.host instance form with the data center location selector highlighted.

Pick a VPS plan with at least:

2 CPU cores

2–4 GB RAM

20 GB SSD storage

Select Debian 12 (Bookworm) as the operating system.

Shape.host instance form with the operating system image selector highlighted.

Create the instance and wait for provisioning to finish.

Shape.host instance form with the Create Instance button highlighted.

Copy the public IP address of the server.

This VPS will host Docker, ntfy, and Nginx, all running securely behind SSL.

Shape.host Resources dashboard with the server IP address highlighted.

Step 2: Connect to Your Debian 12 Server

Linux / macOS

ssh root@YOUR_SERVER_IP

Windows

Use PowerShell, Windows Terminal, or PuTTY:

ssh root@YOUR_SERVER_IP

After login, you should be authenticated as root on Debian 12.


Step 3: Install ntfy Using Docker Compose

3.1 Update the System

apt update

Updates the package index.

apt upgrade -y

Upgrades all installed packages to their latest versions.

Terminal showing APT package management commands and output.

3.2 Install Required Dependencies

apt install ca-certificates curl gnupg lsb-release
Terminal showing APT package management commands and output.

Installs tools required to securely add external repositories.

mkdir -p /etc/apt/keyrings

Creates a directory to store trusted repository keys.


3.3 Add Docker Repository for Debian 12

curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Downloads and registers Docker’s official GPG key.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bookworm stable" > /etc/apt/sources.list.d/docker.list

Adds the Docker repository for Debian Bookworm.

apt update

Refreshes package lists including Docker packages.

Terminal showing APT package management commands and output.

3.4 Install Docker and Docker Compose

apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Terminal showing APT package management commands and output.

Installs Docker Engine and Docker Compose plugin.

docker --version

Verifies Docker installation.

docker compose version

Verifies Docker Compose availability.


3.5 Create ntfy Project Structure

mkdir -p /opt/ntfy
cd /opt/ntfy
Terminal showing the installed Docker Compose version.
nano docker-compose.yml

Paste the following content:

services:
  ntfy:
    image: binwiederhier/ntfy:latest
    container_name: ntfy
    restart: unless-stopped
    ports:
      - "127.0.0.1:2586:80"
    volumes:
      - /opt/ntfy/cache:/var/cache/ntfy
      - /opt/ntfy/config:/etc/ntfy
    command: serve

This configuration:

  • Runs ntfy in a Docker container
  • Binds it only to localhost
  • Prepares it for reverse proxy usage
Terminal showing the GNU nano editor and configuration text.

3.6 Create Cache and Config Directories

mkdir -p /opt/ntfy/cache
mkdir -p /opt/ntfy/config
Terminal showing the installed Docker Compose version.

3.7 Configure ntfy Server

nano /opt/ntfy/config/server.yml

Paste:

base-url: https://ntfy.example.com
listen-http: ":80"

cache-file: /var/cache/ntfy/cache.db
behind-proxy: true

auth-default-access: deny
auth-file: /etc/ntfy/auth.db

attachment-cache-dir: /var/cache/ntfy/attachments
attachment-total-size-limit: 5G
attachment-file-size-limit: 50M

This setup:

  • Enables reverse proxy support
  • Secures access by default
  • Allows controlled file attachments
Terminal showing the GNU nano editor and configuration text.

3.8 Start ntfy

docker compose pull

Pulls the latest ntfy image.

docker compose up -d

Starts ntfy in detached mode.

docker compose ps

Confirms the container is running.

Terminal showing container image download progress.

Step 4: Configure Nginx Reverse Proxy

4.1 Install and Check Nginx

apt install nginx
Terminal showing APT package management commands and output.
systemctl status nginx

4.2 Create Nginx Virtual Host

nano /etc/nginx/sites-available/ntfy

Paste:

server {
    listen 80;
    server_name ntfy.example.com;

    client_max_body_size 100M;

    location / {
        proxy_pass http://127.0.0.1:2586;
        proxy_http_version 1.1;

        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;

        proxy_buffering off;
    }
}
Terminal showing web server configuration text.

4.3 Enable the Configuration

ln -s /etc/nginx/sites-available/ntfy /etc/nginx/sites-enabled/
rm /etc/nginx/sites-enabled/default
nginx -t
systemctl reload nginx
Terminal showing systemd service management commands or output.

Step 5: Enable SSL with Let’s Encrypt

apt install certbot python3-certbot-nginx
Terminal showing APT package management commands and output.
certbot --nginx -d debian-tutorials.shape.host
Terminal showing Certbot certificate commands and messages.

Replace with your real domain, for example:

yourdomain.com

Certbot will:

  • Obtain a free SSL certificate
  • Automatically configure Nginx
  • Enable HTTPS with auto-renewal
ntfy web interface showing that no notification topics have been subscribed to yet.

You have deployed ntfy on Debian 12 using Docker Compose, secured it behind Nginx, and enabled SSL with Let’s Encrypt. This setup is stable, secure, and perfectly suited for production environments and infrastructure notifications.

For hosting services like ntfy with excellent performance, scalability, and full root access, Shape.Host Cloud VPS is a strong choice for modern self-hosted applications.