top of page

Setting up ntfy Push Notification Server on Rocky / RHEL using Nginx

Ntfy push notification server setup image with a smartphone showing a test message, server icons, and logo; blue tech-themed background.

Push notifications are no longer limited to mobile apps or big SaaS platforms. With ntfy, you can send instant push notifications to your mobile or desktop using simple HTTP requests. This makes it extremely useful for DevOps alerts, cron jobs, CI/CD pipelines, monitoring systems, and server-side scripts.

In this blog, we’ll set up ntfy on a Rocky Linux / RHEL server and securely expose it using Nginx as a reverse proxy.

What is ntfy?


ntfy is a lightweight, open-source push notification service that allows you to:

  • Send notifications via curl, scripts, or APIs

  • Subscribe via Android, iOS, or web browser

  • Self-host your own push server

  • Avoid vendor lock-in

Official site: https://ntfy.sh


Architecture Overview


Diagram of ntfy Push Notification Server Architecture. Shows servers, users, cloud, devices, and notification flow with labeled arrows.

Prerequisites


  • Rocky Linux / RHEL 8 or 9

  • Root or sudo access

  • Nginx installed

  • A domain name (example: ntfy.builddevops.com)

  • Open ports: 80 / 443


Step 1: Install ntfy Server


Add ntfy repository
[root@siddhesh ~]# dnf install -y dnf-plugins-core
[root@siddhesh ~]# dnf config-manager --add-repo https://pkgs.ntfy.sh/rpm/ntfy.repo
Install ntfy
[root@siddhesh ~]# dnf install -y ntfy
Verify installation
[root@siddhesh ~]# ntfy --version
ntfy version 2.x.x

Step 2: Configure ntfy Server


Edit the configuration file:

[root@siddhesh ~]# vi /etc/ntfy/server.yml
Minimal production-ready configuration
base-url: "https://ntfy.builddevops.com"
listen-http: "127.0.0.1:2586"
cache-file: "/var/cache/ntfy/cache.db"
auth-file: "/etc/ntfy/auth.db"
attachment-cache-dir: "/var/cache/ntfy/attachments"
behind-proxy: true

Create required directories:

[root@siddhesh ~]# mkdir -p /var/cache/ntfy/attachments
[root@siddhesh ~]# chown -R ntfy:ntfy /var/cache/ntfy

Step 3: Start and Enable ntfy Service

[root@siddhesh ~]# systemctl enable --now ntfy

Check status:

[root@siddhesh ~]# systemctl status ntfy
● ntfy.service - ntfy push notification server
   Active: active (running)

At this stage, ntfy is running locally on 127.0.0.1:2586.


Step 4: Install and Configure Nginx


Install Nginx
[root@siddhesh ~]# dnf install -y nginx

Enable and start:

[root@siddhesh ~]# systemctl enable --now nginx

Step 5: Nginx Reverse Proxy Configuration


Create a new virtual host:

[root@siddhesh ~]# vi /etc/nginx/conf.d/ntfy.conf
Nginx configuration
server {
    listen 80;
    server_name ntfy.builddevops.com;

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

Test configuration:

[root@siddhesh ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload Nginx:

[root@siddhesh ~]# systemctl reload nginx

Step 6: Enable HTTPS (Recommended)


Use Let’s Encrypt with Certbot:

[root@siddhesh ~]# dnf install -y certbot python3-certbot-nginx
[root@siddhesh ~]# certbot --nginx -d ntfy.builddevops.com

After successful issuance, Certbot will automatically update the Nginx config for HTTPS.


Step 7: Sending Test Notifications

Publish a test message
[root@siddhesh ~]# curl -d "builddevops.com test message" https://ntfy.builddevops.com/devops-alerts

Expected output

{"id":"ABC123","time":1735900000,"event":"message","topic":"devops-alerts"}

Step 8: Mobile App Subscription


  1. Install ntfy app from Play Store / App Store

  2. Set server URL:

    https://ntfy.builddevops.com

  3. Subscribe to topic:

    devops-alerts


📱 Sample Mobile Notification Screenshot (Example)
Phone lock screen with a notification from "ntfy" showing "builddevops.com test message." Time is 9:42, January 4. Blue background.

This confirms that your self-hosted ntfy server is working perfectly.


Real-World DevOps Use Cases


  • 🔔 Cron job failure alerts

  • 🔔 Disk / CPU monitoring notifications

  • 🔔 CI/CD pipeline status updates

  • 🔔 Backup success/failure messages

  • 🔔 Security and login alerts


Example from a shell script:

[root@siddhesh ~]# curl -d "Backup completed successfully" https://ntfy.builddevops.com/backups

Security Best Practices


  • Enable auth-file for protected topics

  • Restrict public topics if exposed to internet

  • Always use HTTPS

  • Place ntfy behind Nginx or firewall


Conclusion


Setting up ntfy on Rocky / RHEL with Nginx is simple, powerful, and production-ready. It gives DevOps teams complete control over notifications without relying on third-party services.

If you are building monitoring, automation, or alerting systems, ntfy is a must-have tool in your DevOps toolkit.

👉 For more DevOps tutorials, visit https://builddevops.com


1 Comment

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Guest
Jan 04
Rated 5 out of 5 stars.

Awesome

Like
bottom of page