Knowledgebase

How to install Uptime Kuma with Caddy on Ubuntu 20.04 Print

  • 0

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 -y

Install Docker.

$ apt install docker.io -y

Create a volume for Uptime Kuma.

$ docker volume create uptime-kuma

Start the container.

$ docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1

Update 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:1

Install 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 caddy

Configure 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.

  1. Start by opening the configuration file with nano or your preferred text editor.

     $ sudo nano /etc/ssh/sshd_config
  2. Uncomment the #Port 22 line and change the port to 1337.

    Change:

     #Port 22

    To:

     Port 1337
  3. Save the changes you’ve made to this file and exit.

  4. Finish up by reloading the sshd service.

     $ sudo systemctl reload sshd
  5. Configure 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/Caddyfile

Delete 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
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 -y Install Docker. $ apt install docker.io -y Create a volume for Uptime Kuma. $ docker volume create uptime-kuma Start the container. $ docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1 Update 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:1 Install 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 caddy Configure 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_config Uncomment the #Port 22 line and change the port to 1337. Change: #Port 22 To: Port 1337 Save the changes you’ve made to this file and exit. Finish up by reloading the sshd service. $ sudo systemctl reload sshd Configure 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/Caddyfile Delete 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

Was this answer helpful?
Back

Powered by WHMCompleteSolution