Skip to content

Install_Ubuntu24

Chris Caron edited this page May 10, 2025 · 3 revisions

📦 Installing and Running Apprise API on Ubuntu 24.04

This guide details how to install Apprise API on Ubuntu 24.04 LTS, run it as a systemd service, and use NGINX to serve static files and proxy requests to Gunicorn — required for a proper production deployment.


🛠️ Prerequisites

Install system packages:

sudo apt update
sudo apt install -y python3 python3-pip python3-venv git nginx

Verify installations:

python3.9 --version
pip3.9 --version
git --version

📥 Step 1: Clone and Prepare Apprise API

cd /opt
sudo git clone https://github.com/caronc/apprise-api.git
cd apprise-api

# Optional: Set ownership to the www-data user
sudo chown -R www-data:www-data .

🐍 Step 2: Set Up Virtual Environment

python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt

🔧 Step 3: Create systemd Service

Create the unit file:

sudo nano /etc/systemd/system/apprise.service

Paste this:

[Unit]
Description=Apprise API Service
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/opt/apprise-api
ExecStart=/opt/apprise-api/venv/bin/gunicorn apprise_api.wsgi:application \
    --bind 127.0.0.1:8000 \
    --chdir /opt/apprise-api
Restart=on-failure

[Install]
WantedBy=multi-user.target

▶️ Step 4: Start the Apprise API Service

Reload systemd and enable the service:

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable --now apprise

🌐 Step 5: Configure NGINX Reverse Proxy for Static Files

Edit or create the file:

sudo nano /etc/nginx/sites-available/appriseapi

Use this structure (based on official example):

server {
    listen 80;
    server_name your.domain.com;

    location /static/ {
        alias /opt/apprise-api/static/;
    }

    location / {
        proxy_pass         http://127.0.0.1:8000;
        proxy_redirect     off;
        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-Host $server_name;
    }
}

Enable and start NGINX:

sudo ln -s /etc/nginx/sites-available/appriseapi /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

🧪 Step 6: Access Website

Visit https://127.0.0.1 and see if the Apprise API loads up okay.

🗂️ Log and Runtime Files

  • App directory: /opt/apprise-api
  • Static files: /opt/apprise-api/static/
  • Gunicorn logs: journalctl -u apprise
  • NGINX logs: /var/log/nginx/access.log and /var/log/nginx/error.log

Ensure the user (www by default) has permission to access/write these.

🧼 Service Management Commands

# Manage the service
sudo systemctl status appriseapi
sudo systemctl restart appriseapi
sudo systemctl stop appriseapi

# Check NGINX status
sudo systemctl status nginx