How to Install ntfy (Push Notifications via HTTP) on AlmaLinux 9

Estimated reading: 4 minutes 639 views

Introduction

ntfy is an open-source notification service that lets you send push notifications to browsers, mobile devices, and scripts via simple HTTP requests.

This guide walks you through installing ntfy on AlmaLinux 9 using Docker Compose, with Nginx configured as a reverse proxy.
The setup ensures ntfy runs securely on localhost and is safely exposed to the internet via Nginx.

Step 1: Prerequisites

Before starting, make sure you have:

  • A VPS running AlmaLinux 9

  • Root access to the server

  • A domain name pointing to your server IP (for example: ntfy.example.com)

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 -y

Updates all installed packages to their latest versions.


3.2 Install Required Dependencies

dnf install -y ca-certificates curl gnupg2 dnf-utils

Installs tools required for managing repositories and secure downloads.


3.3 Add Docker Repository

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

Adds the official Docker repository compatible with AlmaLinux 9 and refreshes package metadata.


3.4 Install Docker and Docker Compose

dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Enable and start Docker:

systemctl enable docker
systemctl start docker

Verify the installation:

docker --version
docker compose version

3.5 Create ntfy Project Directory

mkdir -p /opt/ntfy
cd /opt/ntfy

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 inside a Docker container

  • Is accessible only locally

  • Is safely exposed through Nginx


3.7 Create Cache and Configuration Directories

mkdir -p /opt/ntfy/cache
mkdir -p /opt/ntfy/config

3.8 Configure the ntfy Server

nano /opt/ntfy/config/server.yml

Paste:

base-url: http://YOUR_IP_SERVER
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


3.9 Start ntfy

docker compose pull
docker compose up -d
docker compose ps

Step 4: Configure Nginx Reverse Proxy

4.1 Install and Enable Nginx

dnf install -y nginx
systemctl enable nginx
systemctl start nginx
systemctl status nginx

4.2 Create Nginx Configuration for ntfy

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

Paste:

server {
listen 80;
server_name _;

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;
}
}

4.3 Test and Reload Nginx

nginx -t
systemctl reload nginx

Final Step: Service Availability

At this point, ntfy is fully deployed and running on AlmaLinux 9 using Docker Compose, with Nginx acting as a reverse proxy.

The service is accessible directly via the server IP address.

Access URL

http://YOUR_SERVER_IP

This deployment ensures that:

  • ntfy runs securely inside a Docker container

  • The service is bound to localhost only

  • Nginx proxies incoming traffic to ntfy

  • Authentication and attachment limits are enforced

No additional configuration is required to start using ntfy.


Conclusion

You have successfully installed ntfy on AlmaLinux 9 using Docker Compose and configured Nginx as a reverse proxy.

This setup provides:

  • A secure containerized ntfy deployment

  • Local-only service exposure

  • Reverse proxy support with upload handling and authentication

You can now proceed to:

  • Enable HTTPS with Let’s Encrypt

  • Create ntfy users and access tokens

  • Integrate ntfy with scripts, monitoring, or CI/CD pipelines

If you need the HTTPS setup, user/token configuration, or firewall/SELinux tuning, feel free to ask.

Share this Doc

How to Install ntfy (Push Notifications via HTTP) on AlmaLinux 9

Or copy link

CONTENTS