> ## Documentation Index
> Fetch the complete documentation index at: https://docs.digitalfyre.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install Uptime Kuma

[Uptime Kuma](https://github.com/louislam/uptime-kuma) is a self-hosted monitoring tool that supports HTTP, TCP, DNS, ping, and other checks with a clean web UI and notification integrations. This guide deploys it with Docker, an Nginx reverse proxy, and a Let's Encrypt SSL certificate.

## Prerequisites

* Docker and Docker Compose installed — see [Install Docker](/guides/scripts/docker-install)
* A domain or subdomain pointed to your server (e.g., `status.example.com`)
* Ports 80 and 443 open in your firewall

## Step 1: Deploy Uptime Kuma

Create a directory and Docker Compose file:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
mkdir -p /opt/uptime-kuma && cd /opt/uptime-kuma
```

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
cat > docker-compose.yml << 'EOF'
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    restart: unless-stopped
    volumes:
      - ./data:/app/data
    ports:
      - "127.0.0.1:3001:3001"
EOF
```

Start the container:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
docker compose up -d
```

Uptime Kuma is now running on `127.0.0.1:3001`. It is only accessible locally until we set up the reverse proxy.

## Step 2: Install Nginx

<Tabs>
  <Tab title="Debian / Ubuntu" value="debian">
    ```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
    apt update && apt install -y nginx
    systemctl enable nginx
    ```
  </Tab>

  <Tab title="RHEL / AlmaLinux / Rocky" value="rhel">
    ```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
    dnf install -y nginx
    systemctl enable nginx
    systemctl start nginx
    ```
  </Tab>
</Tabs>

## Step 3: Configure Nginx Reverse Proxy

Replace `status.example.com` with your actual domain:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
cat > /etc/nginx/sites-available/uptime-kuma << 'CONF'
server {
    listen 80;
    listen [::]:80;
    server_name status.example.com;

    location / {
        proxy_pass http://127.0.0.1:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        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;
    }
}
CONF
```

Enable the site and reload Nginx:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
ln -sf /etc/nginx/sites-available/uptime-kuma /etc/nginx/sites-enabled/
rm -f /etc/nginx/sites-enabled/default
nginx -t && systemctl reload nginx
```

<Card title="RHEL-Based Systems" type="warning" horizontal>
  RHEL, AlmaLinux, and Rocky do not use `sites-available`/`sites-enabled` by default. Place the configuration in `/etc/nginx/conf.d/uptime-kuma.conf` instead and skip the symlink step.
</Card>

## Step 4: Install SSL with Certbot

<Tabs>
  <Tab title="Debian / Ubuntu" value="debian-cert">
    ```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
    apt install -y certbot python3-certbot-nginx
    ```
  </Tab>

  <Tab title="RHEL / AlmaLinux / Rocky" value="rhel-cert">
    ```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
    dnf install -y epel-release
    dnf install -y certbot python3-certbot-nginx
    ```
  </Tab>
</Tabs>

Obtain and install the certificate:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
certbot --nginx -d status.example.com
```

Certbot will automatically configure HTTPS and set up a redirect from HTTP to HTTPS. Verify automatic renewal is active:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
certbot renew --dry-run
```

## Step 5: Access Uptime Kuma

Open `https://status.example.com` in your browser. On first visit, you will be prompted to create an admin account.

## Updating

To update Uptime Kuma to the latest version:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
cd /opt/uptime-kuma
docker compose pull
docker compose up -d
```

## Backup

Uptime Kuma stores all data in a SQLite database. To back up:

```bash lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
# Stop the container to ensure a clean backup
docker compose stop
cp -r /opt/uptime-kuma/data /backup/uptime-kuma-$(date +%Y%m%d)
docker compose start
```

## All-in-One Script

For convenience, here is the complete setup as a single script. Edit the `DOMAIN` variable before running:

```bash install-uptime-kuma.sh expandable lines theme={"theme":{"light":"light-plus","dark":"ayu-dark"}}
#!/bin/bash
set -euo pipefail

# --- Configuration ---
DOMAIN="status.example.com"
# ---------------------

echo "=== Uptime Kuma Setup ==="

# Detect distribution
. /etc/os-release
DISTRO="$ID"

# Verify Docker is installed
if ! command -v docker &>/dev/null; then
    echo "Docker is not installed. Run the Docker install script first."
    exit 1
fi

# Deploy Uptime Kuma
echo "--- Deploying Uptime Kuma ---"
mkdir -p /opt/uptime-kuma && cd /opt/uptime-kuma
cat > docker-compose.yml << 'EOF'
services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    restart: unless-stopped
    volumes:
      - ./data:/app/data
    ports:
      - "127.0.0.1:3001:3001"
EOF
docker compose up -d

# Install Nginx
echo "--- Installing Nginx ---"
case "$DISTRO" in
    debian|ubuntu)
        apt update -qq
        apt install -y nginx certbot python3-certbot-nginx
        ;;
    almalinux|rocky|centos|rhel|cloudlinux|fedora)
        dnf install -y nginx epel-release
        dnf install -y certbot python3-certbot-nginx
        systemctl start nginx
        ;;
esac
systemctl enable nginx

# Configure Nginx
echo "--- Configuring Nginx ---"
case "$DISTRO" in
    debian|ubuntu)
        NGINX_CONF="/etc/nginx/sites-available/uptime-kuma"
        cat > "$NGINX_CONF" << CONF
server {
    listen 80;
    listen [::]:80;
    server_name $DOMAIN;

    location / {
        proxy_pass http://127.0.0.1:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade \$http_upgrade;
        proxy_set_header Connection "upgrade";
        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;
    }
}
CONF
        ln -sf "$NGINX_CONF" /etc/nginx/sites-enabled/
        rm -f /etc/nginx/sites-enabled/default
        ;;
    almalinux|rocky|centos|rhel|cloudlinux|fedora)
        cat > /etc/nginx/conf.d/uptime-kuma.conf << CONF
server {
    listen 80;
    listen [::]:80;
    server_name $DOMAIN;

    location / {
        proxy_pass http://127.0.0.1:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade \$http_upgrade;
        proxy_set_header Connection "upgrade";
        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;
    }
}
CONF
        ;;
esac

nginx -t && systemctl reload nginx

# SSL
echo "--- Obtaining SSL Certificate ---"
certbot --nginx -d "$DOMAIN" --non-interactive --agree-tos --register-unsafely-without-email --redirect

echo ""
echo "=== Setup Complete ==="
echo "Access Uptime Kuma at: https://$DOMAIN"
echo "Create your admin account on first login."
```

<Tip>
  The `--register-unsafely-without-email` flag skips the email prompt for unattended installation. For production use, replace it with `--email your@email.com` to receive certificate expiration notices.
</Tip>
