This repository provides a ready-to-use Docker Compose setup to run Uptime Kuma behind an Nginx reverse proxy with a subfolder path (/kuma
).
Deploying Uptime Kuma under a subfolder (like /kuma
) has been a common challenge as discussed in Uptime Kuma issue #147. This project explain how it can be achieved using Docker Compose and Nginx.:
- Configuring Nginx as a reverse proxy to serve Uptime Kuma under a subfolder
- Providing a custom entrypoint script that modifies the necessary paths in the Uptime Kuma frontend
- Setting up proper environment variables to make everything work together
Adding support in the original Uptime Kuma will be a great improvement, but until then, this setup provides a workaround.
- Docker and Docker Compose installed on your system
- Git (to clone this repository)
-
Clone this repository:
git clone https://github.com/arulrajnet/uptime-kuma-subfolder-compose.git cd uptime-kuma-subfolder-compose
-
Make the entrypoint script executable:
chmod +x entrypoint.sh
-
Start the services using Docker Compose:
docker compose up -d
-
Access Uptime Kuma at:
http://localhost:8080/kuma
The docker-compose.yml
file sets up:
- An Nginx service acting as a reverse proxy
- Uptime Kuma service configured to run under the
/kuma
path - Persistent volume for Uptime Kuma data
Key configurations in the Uptime Kuma service:
- The
SERVER_CONTEXTPATH: "/kuma"
environment variable tells Uptime Kuma to use the subfolder - A custom entrypoint script modifies the frontend resources to work with the subfolder path
The kuma-nginx.conf
file configures Nginx to:
- Listen on port 8080
- Proxy requests from
/kuma
to the Uptime Kuma service - Strip the
/kuma
prefix when forwarding requests - Add the
/kuma
prefix back to response headers (like Location)
# Key part of the configuration
location /kuma {
# Strip /kuma prefix
rewrite ^/kuma/?(.*)$ /$1 break;
# Proxy to upstream service
proxy_pass http://kuma_service;
}
This project is licensed under the MIT License - see the LICENSE file for details.