<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=Ntfy</id>
	<title>Ntfy - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=Ntfy"/>
	<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Ntfy&amp;action=history"/>
	<updated>2026-08-30T06:49:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.nixos.org/w/index.php?title=Ntfy&amp;diff=34572&amp;oldid=prev</id>
		<title>Arnecc: created initial page</title>
		<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Ntfy&amp;diff=34572&amp;oldid=prev"/>
		<updated>2026-08-29T21:58:03Z</updated>

		<summary type="html">&lt;p&gt;created initial page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;[https://ntfy.sh/ ntfy]&amp;#039;&amp;#039;&amp;#039; is a HTTP-based pub-sub notification service. It allows sending notifications to a phone or desktop via scripts from any computer, and/or using a REST API. It can be used for free, with a paid plan or self-hosted. The latter is documented in this article.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Enable the ntfy module in your configuration and define some basic options:&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
services.ntfy-sh = {&lt;br /&gt;
    enable = true;&lt;br /&gt;
    settings = {&lt;br /&gt;
      base-url = &amp;quot;https://ntfy.yourdomain.com&amp;quot;;&lt;br /&gt;
      behind-proxy = true;&lt;br /&gt;
      };&lt;br /&gt;
    };&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You also should set up a virtual host via nginx or caddy:&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
services.nginx.virtualHosts = {&lt;br /&gt;
    &amp;quot;ntfy.yourdomain.com&amp;quot; = {&lt;br /&gt;
      forceSSL = true;&lt;br /&gt;
      enableACME = true;&lt;br /&gt;
      locations.&amp;quot;/&amp;quot; = {&lt;br /&gt;
        proxyPass = &amp;quot;http://localhost:2586&amp;quot;;&lt;br /&gt;
        proxyWebsockets = true;  # Required for ntfy streaming&lt;br /&gt;
        };&lt;br /&gt;
      };&lt;br /&gt;
    };&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
If you haven&amp;#039;t done so for other services, you will also need an [[ACME]] setup. A minimal working example:&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
security.ACME = {&lt;br /&gt;
    acceptTerms = true;&lt;br /&gt;
    defaults.email = &amp;lt;youremail&amp;gt;;&lt;br /&gt;
    };&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Also note that you might need to restart the ACME service after first setup due to a bug:&lt;br /&gt;
&lt;br /&gt;
{{ic|sudo systemctl restart acme-ntfy.yourdomain.com.service}}&lt;br /&gt;
&lt;br /&gt;
=== Authentication (optional but recommended) ===&lt;br /&gt;
&lt;br /&gt;
For a private instance you should restrict access. Set up a user database and default to denying all access:&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
services.ntfy-sh.settings = {&lt;br /&gt;
  auth-file = &amp;quot;/var/lib/ntfy-sh/user.db&amp;quot;;&lt;br /&gt;
  auth-default-access = &amp;quot;deny-all&amp;quot;;&lt;br /&gt;
  enable-signup = false;&lt;br /&gt;
};&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Define users and access tokens (tokens can be generated with {{ic|ntfy token generate}}).&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
services.ntfy-sh.settings = {&lt;br /&gt;
  auth-users = [&lt;br /&gt;
    # &amp;lt;username&amp;gt;:&amp;lt;password-hash&amp;gt;:&amp;lt;role&amp;gt;   role is &amp;quot;user&amp;quot; or &amp;quot;admin&amp;quot;&lt;br /&gt;
    &amp;quot;admin:$2a$10$&amp;lt;bcrypt-hash&amp;gt;:admin&amp;quot;&lt;br /&gt;
    &amp;quot;backup-service:$2a$10$&amp;lt;bcrypt-hash&amp;gt;:user&amp;quot;&lt;br /&gt;
  ];&lt;br /&gt;
  auth-tokens = [&lt;br /&gt;
    # &amp;lt;username&amp;gt;:&amp;lt;token&amp;gt;[:&amp;lt;optional free form label&amp;gt;]&lt;br /&gt;
    &amp;quot;admin:tk_&amp;lt;token&amp;gt;&amp;quot;&lt;br /&gt;
    &amp;quot;backup-service:tk_&amp;lt;token&amp;gt;:backup script token&amp;quot;&lt;br /&gt;
  ];&lt;br /&gt;
};&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Define an access control list (ACL). The format is {{ic|username:topic-pattern:access}}, where access is {{ic|read-write}}/{{ic|rw}}, {{ic|read-only}}/{{ic|ro}}, {{ic|write-only}}/{{ic|wo}} or {{ic|deny-all}}. The wildcard {{ic|*}} matches any number of characters in a topic pattern, and the special user {{ic|*}} means &amp;quot;everyone&amp;quot; (including anonymous):&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
services.ntfy-sh.settings = {&lt;br /&gt;
  auth-access = [&lt;br /&gt;
    &amp;quot;user:*:rw&amp;quot;        # you can read &amp;amp; write everything&lt;br /&gt;
    &amp;quot;backup-service:backups:*:rw&amp;quot;   # only its own topics&lt;br /&gt;
  ];&lt;br /&gt;
};&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
After a {{ic|nixos-rebuild switch}}, the {{ic|user.db}} is created automatically and the users/tokens/ACL entries are applied.&lt;br /&gt;
&lt;br /&gt;
If your ntfy instance is private ({{ic|1=auth-default-access = &amp;quot;deny-all&amp;quot;}}), and you want to use it as a [https://unifiedpush.org/ UnifiedPush] push server (e.g. for [[MollySocket]] or Matrix/fediverse push), you must explicitly allow anonymous write access to the {{ic|up*}} topic prefix as application servers such as mollysocket are not registered users and cannot authenticate:&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
services.ntfy-sh.settings = {&lt;br /&gt;
  auth-access = [&lt;br /&gt;
    &amp;quot;*:up*:write-only&amp;quot;    # anonymous app-servers may publish to UnifiedPush topics&lt;br /&gt;
  ];&lt;br /&gt;
};&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Use ==&lt;br /&gt;
&lt;br /&gt;
=== Publishing ===&lt;br /&gt;
&lt;br /&gt;
Publishing is done via HTTP PUT/POST or the {{ic|ntfy}} CLI. Topics are created on the fly by publishing or subscribing to them, so for basic use no configuration is needed at all. Because there is no sign-up, a topic name is essentially a password. That&amp;#039;s why you should pick something not easily guessable:&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
# Simple message (default priority)&lt;br /&gt;
curl -d &amp;quot;Backup finished&amp;quot; https://ntfy.yourdomain.com/mytopic&lt;br /&gt;
&lt;br /&gt;
# With title, priority and tags&lt;br /&gt;
curl -H &amp;quot;Title: Backup&amp;quot; -H &amp;quot;Priority: high&amp;quot; -H &amp;quot;Tags: warning&amp;quot; \&lt;br /&gt;
     -d &amp;quot;Backup of server failed&amp;quot; https://ntfy.yourdomain.com/backups&lt;br /&gt;
&lt;br /&gt;
# From a script&lt;br /&gt;
ntfy publish mytopic &amp;quot;Something has happened&amp;quot;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
If access control is enabled and the topic does not allow anonymous writes, authenticate with a token ({{ic|ntfy://:TOKEN@DOMAIN/TOPIC}} or {{ic|Authorization: Bearer}}):&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
curl -H &amp;quot;Authorization: Bearer tk_...&amp;quot; -d &amp;quot;Backup finished&amp;quot; \&lt;br /&gt;
     https://ntfy.yourdomain.com/backups&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=== Subscribing ===&lt;br /&gt;
&lt;br /&gt;
Subscribe via the web app ([https://ntfy.sh/app ntfy.sh/app] on your own instance), the mobile app, or the API. The subscription API supports plain HTTP streams (JSON, SSE or raw) and WebSockets:&lt;br /&gt;
&lt;br /&gt;
{{bc|1=&lt;br /&gt;
# Stream as JSON lines&lt;br /&gt;
curl -s https://ntfy.yourdomain.com/mytopic/json&lt;br /&gt;
&lt;br /&gt;
# Server-sent events&lt;br /&gt;
curl -s https://ntfy.yourdomain.com/mytopic/sse&lt;br /&gt;
&lt;br /&gt;
# WebSocket (wss://)&lt;br /&gt;
wscat -c wss://ntfy.yourdomain.com/mytopic/ws&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Android (Play Store + F-Droid) and iOS apps are available, too. On Android, the app can also act as a [https://unifiedpush.org/ UnifiedPush] distributor, forwarding pushes to other apps (e.g. Molly/[[MollySocket]]). On NixOS, the {{ic|ntfy}} package can be used to subscribe to topics and receive notifications on your desktop. &lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[MollySocket]] - Use ntfy to provide notifications for the Signal-fork [https://molly.im/ Molly]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Full documentation:&amp;#039;&amp;#039;&amp;#039; [https://docs.ntfy.sh/ ntfy docs], [https://docs.ntfy.sh/config/ configuration], [https://docs.ntfy.sh/publish/ publishing].&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;/div&gt;</summary>
		<author><name>Arnecc</name></author>
	</entry>
</feed>