Introduction
This article explains how to install Uptime Kuma with Caddy. Uptime Kuma is a self-hosted monitoring tool like "Uptime Robot". Caddy 2 is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go.
Requirements
You need a freshly installed Ubuntu 20.04 cloud server. It should have a minimum of 1 vCPU, 10 GB of storage, and 512 MB of RAM. For best performance, 1 GB or RAM or more is recommended.
Install Uptime Kuma
Update the server.
$ apt update && apt upgrade -yInstall Docker.
$ apt install docker.io -yCreate a volume for Uptime Kuma.
$ docker volume create uptime-kumaStart the container.
$ docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1Update Uptime Kuma
$ docker pull louislam/uptime-kuma:1
$ docker stop uptime-kuma
$ docker rm uptime-kuma
$ docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1Install Caddy
$ sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
$ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | $ sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
$ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
$ sudo apt update
$ sudo apt install caddyConfigure SSH and Firewall
Setting up your VPS is pretty simple. We will go through things like Changing SSH port, allowing certain ports via UFW and more.
Start by opening the configuration file with nano or your preferred text editor.
$ sudo nano /etc/ssh/sshd_configUncomment the
#Port 22line and change the port to 1337.Change:
#Port 22To:
Port 1337Save the changes you’ve made to this file and exit.
Finish up by reloading the sshd service.
$ sudo systemctl reload sshdConfigure the firewall.
$ ufw allow 8001/tcp && ufw allow 8001/udp $ ufw allow 80/tcp && ufw allow 80/udp $ ufw allow 443/tcp
Configure the Caddy Uptime Kuma Domain
To make Uptime Kuma work with a Fully-Qualified Domain Name and Cloudflare DNS you need to edit the Caddyfile.
$ nano /etc/caddy/CaddyfileDelete everything in the file and replace it with:
subdomain.domain.com {
reverse_proxy 127.0.0.1:3001
}Error Recovery
If the website wont load, follow these steps:
$ pkill nginx
$ pkill caddy
$ sudo service caddy start