TroubleChute Logo
DEBIAN LINUX

Install Checkmk Behind Nginx (Not Apache)


Published: Jul 3, 2024
Last Edit: Jul 3, 2024
Linux Monitoring Web Hosting
680 Words, 3 Minutes.

Checkmk

Checkmk is a program for infrastructure monitoring. It’s great software, and the free version gives access to a lot of great features. This works by installing itself and using a port locally, which is great… But not so great: It installs Apache and wants you to use that as the front-end automatically through a reverse-proxy. This is fine in most cases, however if you’re like me, using Nginx, how do we stop using Apache and instead use Nginx?

That’s simple.

Installing Checkmk

First, installing Checkmk. Follow the installation insructions on the Checkmk Download Page for your version. Likely you’ll select Raw, and Ubuntu or Debian.

The steps in this guide are for Ubuntu/Debian, but similar commands should work for other platforms as well.

For me, it was (For Ubuntu 22.04, using Checkmk 2.3.0p8):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Installing
wget https://download.checkmk.com/checkmk/2.3.0p8/check-mk-raw-2.3.0p8_0.jammy_amd64.deb
sudo apt install ./check-mk-raw-2.3.0p8_0.jammy_amd64.deb

# Verifying installation completed
omd version

# Then create and start monitoring
sudo omd create monitoring
sudo omd start monitoring

Also: Make a note of the username and password in the console at this point. You will need them to login to the Checkmk panel.

Later, you can use cmk-passwd cmkadmin to change the password, should you need to.

Switching from Apache to Nginx

At this point Checmk is running, and Apache is installed and attempted to start. If you’re running an Nginx server locally, or under Docker and ports 80 are already used: Apache failed to start.

This is great as there shouldn’t be any conflicts. Now, to shut down and disable Apache.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Check the status of Apache
sudo systemctl status apache2

# You will likely see "Active: failed"
# Followed by "Address already in use: AH00072: make_sock: could not bind to address [::]:80"
# and Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

# This is good, let's disable Apache2 so it doesn't start again:
sudo systemctl stop apache2
sudo systemctl disable apache2

And that’s it. Apache should now be disabled. There should be no worry of it conflicting with Nginx while it’s disabled.

Using Nginx as a reverse proxy

There are a few ways of adding bits to your existing website. I chose to use it on a subdomain, but you could leave it as your domain /monitoring, as suggested by the installer.

The installer shows The default web UI is available at http://tcno.co/monitoring/, where tcno.co is my system’s hostname. This assumes that you leave the Apache server running in the default configuration, and don’t use Nginx or another web hosting software.

For me, I create a new site .conf file in my Nginx sites-available folder, and symlink to sites-enabled, so let’s do that.

1
nano /etc/nginx/sites-available/checkmk.conf

And I entered the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
server {
    server_name tcno.co;

    location /monitoring {
        proxy_pass http://127.0.0.1:5000/monitoring;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_cache_bypass $http_upgrade;
        proxy_read_timeout 120s;
    }

    listen 80;
    listen [::]:80;
}

If you’re using Certbot for SSL, or want 443 to be used for https, you will obviously include that as well. This is just a barebones setup for just the /monitoring end point to work.

How did I get 127.0.0.1:5000? Will this work for you? Maybe not.

You can get the port and address of Checmk from the Apache configuration file. There must be another way, but this is how I did it:

1
nano /omd/apache/monitoring.conf

You should find the address of Checkmk next to ProxyPass.

Now, link and enable the site for Nginx:

1
2
3
4
5
6
7
ln -s /etc/nginx/sites-available/checkmk.conf /etc/nginx/sites-enabled/checkmk.conf

# Check Nginx's health with the new files before loading them to prevent downtime:
nginx -t

# Assuming everything is OK
sudo service nginx reload

Now you should be able to access your new Checkmk installation using your Nginx server on your domain.

Just make sure to secure it as you see fit, and set up SSL/HTTPS if you haven’t already.

TroubleChute © Wesley Pyburn (TroubleChute)
Support Me Privacy Policy Cookies Policy Terms of Service Change privacy settings Contact