Installation

NotifyHero is based on ntfy, which can be self-hosted. This guide covers various installation methods.

Docker (Recommended)

The easiest way to run your own server:

docker run -p 80:80 binwiederhier/ntfy serve

With persistent storage:

docker run -d \
  -v /var/cache/ntfy:/var/cache/ntfy \
  -v /etc/ntfy:/etc/ntfy \
  -p 80:80 \
  --name ntfy \
  binwiederhier/ntfy serve

Docker Compose

version: "3"
services:
  ntfy:
    image: binwiederhier/ntfy
    container_name: ntfy
    command: serve
    volumes:
      - ./cache:/var/cache/ntfy
      - ./etc:/etc/ntfy
    ports:
      - "80:80"
    restart: unless-stopped

Binary Installation

Debian/Ubuntu

# Download the latest release
wget https://github.com/binwiederhier/ntfy/releases/download/v2.8.0/ntfy_2.8.0_linux_amd64.deb

# Install
sudo dpkg -i ntfy_2.8.0_linux_amd64.deb

# Start the service
sudo systemctl enable ntfy
sudo systemctl start ntfy

Other Linux

# Download and extract
wget https://github.com/binwiederhier/ntfy/releases/download/v2.8.0/ntfy_2.8.0_linux_amd64.tar.gz
tar -xzf ntfy_2.8.0_linux_amd64.tar.gz

# Install
sudo mv ntfy /usr/local/bin/
sudo chmod +x /usr/local/bin/ntfy

# Run
ntfy serve

macOS

brew install ntfy
ntfy serve

Windows

Download the Windows binary from GitHub Releases and run:

ntfy.exe serve

Building from Source

# Clone the repository
git clone https://github.com/binwiederhier/ntfy.git
cd ntfy

# Build
make build

# Run
./ntfy serve

Configuration

Create a config file at /etc/ntfy/server.yml:

base-url: "https://ntfy.example.com"
listen-http: ":80"
cache-file: "/var/cache/ntfy/cache.db"
attachment-cache-dir: "/var/cache/ntfy/attachments"

See the Configuration page for all options.

Reverse Proxy Setup

nginx

server {
    listen 443 ssl;
    server_name ntfy.example.com;

    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;

    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;

        # WebSocket support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # SSE support
        proxy_buffering off;
        proxy_cache off;
    }
}

Traefik

labels:
  - "traefik.enable=true"
  - "traefik.http.routers.ntfy.rule=Host(`ntfy.example.com`)"
  - "traefik.http.routers.ntfy.tls.certresolver=letsencrypt"
  - "traefik.http.services.ntfy.loadbalancer.server.port=80"

Caddy

ntfy.example.com {
    reverse_proxy localhost:2586
}

Systemd Service

Create /etc/systemd/system/ntfy.service:

[Unit]
Description=ntfy server
After=network.target

[Service]
ExecStart=/usr/local/bin/ntfy serve
Restart=always
User=ntfy
Group=ntfy

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable ntfy
sudo systemctl start ntfy

Verification

Test your installation:

# Publish a test message
curl -d "Test message" http://localhost/test

# Subscribe
curl http://localhost/test/json?poll=1

Next Steps