ntfy (Push Notifications via HTTP) on AlmaLinux 9

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

With ntfy, sending a notification can be as simple as a single curl command. This makes it especially useful for server monitoring, CI/CD pipelines, cron jobs, webhooks, DevOps automation, and IoT systems.

Running ntfy on AlmaLinux 9, a RHEL-compatible, enterprise-grade Linux distribution, provides long-term stability, security updates, and predictable behavior. AlmaLinux 9 is well suited for production workloads and pairs perfectly with Nginx and HTTPS, resulting in a secure, reliable, and maintainable push notification service.


Architecture Overview

LayerComponentRole
OSAlmaLinux 9Enterprise-grade, RHEL-compatible 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, making it extremely fast, resource-efficient, and easy to manage.


Why Use ntfy?

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

ntfy is designed for users who want reliable notifications without unnecessary 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 AlmaLinux 9

  • 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 configuration files or environment variables.
  • Enable SELinux enforcing mode and configure Docker/paths accordingly.
  • Configure firewalld to allow only ports 80 and 443.
  • Add rate limiting in Nginx to prevent abuse.
  • Keep AlmaLinux 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 AlmaLinux 9 with SSL gives you a fast, secure, and fully self-hosted push notification system — ideal for automation, monitoring, and real-time alerts, all while keeping full control over your data and infrastructure.


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

Before installing ntfy, you need a virtual server.

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

Open the dashboard and click Create.

Choose Instance as the resource type.

Shape.host Resources dashboard with Create > Instance highlighted.

Select a data center location close to your users.

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

Choose a VPS plan with at least:

2 CPU cores

2–4 GB RAM

20 GB SSD storage

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

Select AlmaLinux 9 (64-bit) as the operating system.

Finalize the creation and wait for the instance to be provisioned.

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

Copy the public IP address of your server.

This server will host Docker, ntfy, and Nginx, secured with HTTPS.

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

Step 2: Connect to Your AlmaLinux 9 Server

Linux / macOS

ssh root@YOUR_SERVER_IP

Windows

Use PowerShell, Windows Terminal, or PuTTY:

ssh root@YOUR_SERVER_IP

After logging in, you should be authenticated as root.


Step 3: Install ntfy Using Docker Compose

3.1 Update the System

dnf update

Updates all installed packages to their latest versions.

Terminal showing DNF/YUM package management commands and output.

3.2 Install Required Dependencies

dnf install ca-certificates curl gnupg2 dnf-utils

Installs tools required for managing repositories and secure downloads.

Terminal showing DNF/YUM package management commands and output.

3.3 Add Docker Repository

dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Adds the official Docker repository compatible with AlmaLinux 9.

dnf makecache

Refreshes the package metadata cache.

Terminal showing docker commands or output during Add Docker Repository.

3.4 Install Docker and Docker Compose

dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Terminal showing DNF/YUM package management commands and output.

Installs Docker Engine and Docker Compose plugin.

systemctl enable docker

Enables Docker to start automatically at boot.

systemctl start docker

Starts the Docker service.

docker --version

Verifies Docker installation.

docker compose version

Verifies Docker Compose availability.


3.5 Create ntfy Project Directory

mkdir -p /opt/ntfy
cd /opt/ntfy
Terminal showing systemd service management commands or output.

3.6 Create Docker Compose Configuration

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 ensures ntfy:

  • Runs in a Docker container
  • Is only accessible locally
  • Is safely exposed through Nginx
Terminal showing the GNU nano editor and configuration text.

3.7 Create Cache and Configuration Directories

mkdir -p /opt/ntfy/cache
mkdir -p /opt/ntfy/config
Terminal showing file and directory setup commands.

3.8 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 configuration:

  • Enables reverse proxy support
  • Denies anonymous access by default
  • Allows controlled attachment uploads
Terminal showing the GNU nano editor and configuration text.

3.9 Start ntfy

docker compose pull

Downloads the latest ntfy image.

docker compose up -d

Starts the ntfy container 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 Enable Nginx

dnf install nginx
Terminal showing DNF/YUM package management commands and output.
systemctl enable nginx
systemctl start nginx
systemctl status nginx
Terminal showing systemd service management commands or output.

4.2 Create Nginx Configuration for ntfy

nano /etc/nginx/conf.d/ntfy.conf

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 Test and Reload Nginx

nginx -t
systemctl reload nginx
Terminal showing systemd service management commands or output.

Step 5: Enable SSL with Let’s Encrypt

5.1 Install Certbot

dnf install epel-release
dnf install certbot python3-certbot-nginx
Terminal showing DNF/YUM package management commands and output.

5.2 Obtain SSL Certificate

certbot --nginx -d ntfy.example.com
Terminal showing Certbot certificate commands and messages.

Replace with your real domain if needed:

yourdomain.com

Certbot will automatically:

  • Issue a free SSL certificate
  • Configure Nginx for HTTPS
  • Enable automatic renewal
ntfy web interface showing that no notification topics have been subscribed to yet.

You have installed ntfy on AlmaLinux 9 using Docker Compose, secured it behind Nginx, and enabled SSL with Let’s Encrypt. This setup is stable, secure, and well-suited for production use cases such as monitoring, alerting, and automation.

For hosting ntfy and other self-hosted services with excellent performance and scalability, Shape.Host Cloud VPS offers a reliable infrastructure designed for modern server workloads.