@sebmegag hi. Welcome aboard! I’ve tried this on both iPhone and Android and it works fine. Did you double check the config you have?
Guides
Do cool things on your website…
Trending
Trending
First, devise a naming convention for your NTFY installation. This ideally should be a subdomain as it means you can logically and physically separate your main instance of NodeBB (for example) and make it work independently. This is highly recommended, as we will be using a reverse proxy to setup NTFY and some of those settings differ to what NodeBB already uses.
First, choose a subdomain you’d like to use – in my case, this will be notify.sudonix.org, and will point to the same IP address as the server hosting my NodeBB installation. You’ll obviously need to make changes to your DNS so that this works as intended. If you are using Cloudflare, you must disable the proxy.
0358aa66-573d-408b-adfc-dd33b58f1166-image.png
Allow sufficient time for the DNS to replicate fully. I typically set a low TTL (Time To Live) where possible, and CF allows you to set as low as 60 seconds. You can check on DNS population progress using one of the many checkers available - this one is my go-to
https://www.whatsmydns.net/
Now that your DNS record has populated, you can start working on the NTFY build.
Depending on the version of Linux (or even Windows) you are using, there are a multitude of different packages you can use, including those maintained by Ubuntu / Debian themselves. For the purposes of this guide, I’m assuming Ubuntu / Debian, and this means you should use the below (as root)
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://archive.heckel.io/apt/pubkey.txt | sudo gpg --dearmor -o /etc/apt/keyrings/archive.heckel.io.gpg sudo apt install apt-transport-https sudo sh -c "echo 'deb [arch=amd64 signed-by=/etc/apt/keyrings/archive.heckel.io.gpg] https://archive.heckel.io/apt debian main' \ > /etc/apt/sources.list.d/archive.heckel.io.list" sudo apt update sudo apt install ntfy sudo systemctl enable ntfy sudo systemctl start ntfyAt this point, we could run ntfy serve although this will start the communication on port 80 which isn’t what we want because it will conflict with NGINX, so we will need to change the port
sudo nano /etc/ntfy/server.ymlMake the below changes, obviously substituting my any details with your own
# All the things: Behind a proxy, Firebase, cache, attachments, # SMTP publishing & receiving base-url: "https://<your domain fqdn>" listen-http: "127.0.0.1:2586" cache-file: "/var/cache/ntfy/cache.db" behind-proxy: true attachment-cache-dir: "/var/cache/ntfy/attachments" keepalive-interval: "45s"Note that if you need to support iOS based devices, you must add the below directly under the base-url: line
upstream-base-url: "https://ntfy.sh"Now issue ntfy serve and ensure that the instance starts with the correct port
04cdabe2-0aba-4b73-a1b9-bece9edf2f36-image.png
A sample of the NGINX configuration will look like this
server { listen <your ip address>; server_name <your server name>; root <path to your home directory> location / { # Redirect HTTP to HTTPS, but only for GET topic addresses, since we want # it to work with curl without the annoying https:// prefix set $redirect_https ""; if ($request_method = GET) { set $redirect_https "yes"; } if ($request_uri ~* "^/([-_a-z0-9]{0,64}$|docs/|static/)" ) { set $redirect_https "${redirect_https}yes"; } if ($redirect_https = "yesyes" ) { return 302 https://$http_host$request_uri$is_args$query_string; } proxy_pass http://127.0.0.1:2586; proxy_http_version 1.1; proxy_buffering off; proxy_request_buffering off; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 3m; proxy_send_timeout 3m; proxy_read_timeout 3m; client_max_body_size 0; # Stream request body to backend } ssl_certificate /home/sudonix.org/ssl.cert; ssl_certificate_key /home/sudonix.org/ssl.key; } server { listen <your ip address>:443 ssl http2; server_name notify.sudonix.org; root <path to your home directory> # See https://ssl-config.mozilla.org/#server=nginx&version=1.18.0&config=intermediate&openssl=1.1.1k&hsts=false&ocsp=false&guideline=5.6see https://ssl-config.mozilla.org/#server=nginx&version=1.18.0&config=intermediate&openssl=1.1.1k&hsts=false&ocsp=false&guideline=5.6 ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; # about 40000 sessions ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; ssl_certificate <path yo your certificate file> ssl_certificate_key <path yo your certificate key> location / { proxy_pass http://127.0.0.1:2586; proxy_http_version 1.1; proxy_buffering off; proxy_request_buffering off; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 3m; proxy_send_timeout 3m; proxy_read_timeout 3m; client_max_body_size 0; # Stream request body to backend } }Obviously, you need to supply the information requested in <your information> as this pertains to your installation. Now save your config, ensure there are no errors, and in the console, issue ntfy serve. Now browse to the URL you want to use, and you should see something like the below
caaebe69-0017-42ed-9828-4b78971319cd-image.png
In the ACP, go to Plugins -> NTFY, and set your NTFY URL
6ea26962-b6f9-4021-893b-0324fc044d99-image.png
Note, that the Access Token isn’t mandatory, but is a good idea to secure the stream. You can generate your own (64bit) here. Use the format in NodeBB as tk_<token>
https://it-tools.tech/token-generator
Click Save Changes, and restart NodeBB
Now go your profile settings in NodeBB and select “Push Notifications”
aea5d7be-b4e2-4cd0-a5e7-2aade84c0fc9-image.png
Copy “Private Push Link” and then go to your NTFY self-hosted instance - note, you’ll also see that there is a “Subscribe” button which you can use if you prefer, but you’ll need the latest version of nodebb-plugin-ntfy installed.
Click “Subscribe to a topic”
104f493d-c616-40a8-b2ed-54b7cf359a44-image.png
Paste the value you copied previously
9baf0d3b-632c-4b56-b71f-4801e42c0246-image.png
Click Subscribe
Now go back to your user settings, and click “Send test notification”
82d8f381-028d-43cd-9ceb-b2206ec4b6ec-image.png
Ensure you see the message appear in your new instance
2cb45232-251a-4292-830f-2d727cf947bc-image.png
The message should have arrived! If it has, then you’re done.
Well - almost. There is a raft of settings you can apply, such as tokens, ACL’s etc - the guide is very verbose and goes into specific detail, which you can review here
IMPORTANT: if you are using a mobile device, you should install the dedicated apps for Android and iOS rather than use the web versions.
https://docs.ntfy.sh/
Hi phenomlab!
I read on nodebb forum that you self host your ntfy. Would it be possible that you can write a guide for it? I tried it myself but port 80 is already in use. I could maybe configure a different port in the server.yml but then I also would have to configure Nginx I guess? Maybe you could show us the steps you did. 🙂
I would appreciated it.