Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Deploying Uptime Kuma With Docker

  1. About
    1. Prerequisites
  2. Docker Deployment Instructions
  3. Nginx Reverse Proxy Configuration
    1. Trust Forwarding Headers
  4. Resources

About

Uptime Kuma is an open source project (GitHub) that acts like an uptime monitor similar to uptime Robot. This guide will get you up and running an Uptime Kuma monitoring server in seconds.

For a video providing a lot more information going through Uptime Kuma, feel free to what the youtube video below from Techno Tim.

Prerequisites

Docker Deployment Instructions

Create a docker-compose file...

editor docker-compose.yml

... and give it the following contents:

services:
  app:
    container_name: uptime-kuma
    image: louislam/uptime-kuma:1
    restart: always
    volumes:
      - uptime-kuma:/app/data
    ports:
      - "80:3001"

volumes:
  uptime-kuma:
    driver: local

Now launch the service by running:

docker-compose up -d

You should now be able to access the service in your browser by going to your server's FQDN or IP. If doing this locally, then it would just be localhost.

Nginx Reverse Proxy Configuration

Below is an example configuration I plugged into my Nginx reverse proxy, which will terminate the HTTPS connection, and allow Uptime Kuma to work with its websockets.

server {
    listen 80;
    server_name uptime-kuma.mydomain.com;
    access_log  /var/log/nginx/uptime-kuma.mydomain.com-access.log;
    return 302 https://uptime-kuma.mydomain.com$request_uri;
}

server {
    listen 443 ssl;

    ssl on;

    server_name uptime-kuma.mydomain.com;

    access_log  /var/log/nginx/uptime-kuma.mydomain.com-access.log;

    ssl_certificate      /path/to/ssl/site.crt;
    ssl_certificate_key  /path/to/ssl/private.pem;

    ssl_protocols               TLSv1.1 TLSv1.2;
    ssl_ciphers                 RC4:HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;
    keepalive_timeout           60;
    ssl_session_cache           shared:SSL:10m;
    ssl_session_timeout         10m;

    proxy_set_header            Connection '';
    proxy_http_version          1.1;
    chunked_transfer_encoding   off;
    proxy_buffering             off;
    proxy_cache                 off;

    location / {
        proxy_pass              http://192.168.0.xxx/;
        proxy_http_version      1.1; # 1.1 instead of 1.0 is required for websockets
        proxy_set_header        Upgrade $http_upgrade;
        proxy_set_header        Connection "upgrade";
        proxy_set_header        Host $http_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 https;
        proxy_set_header        X-Nginx-Proxy true;
        proxy_redirect          off;
    }
}

Be sure to replace the following in that configuration:

  • uptime-kuma.mydomain.com - plug in your site's FQDN
  • http://192.168.0.xxx/ - replace with the internal IP address of your Uptime Kuma server.
  • /path/to/ssl - replace with the path to the directory containing your SSL certificates for Nginx to use.

Trust Forwarding Headers

If you are using a reverse proxy, don't forget to set the trust forwarded headers in the settings area as shown below:

Resources

Last updated: 21st January 2025
First published: 6th October 2021

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch