Caddy as reverse proxy for checkmk

1. The problem I’m having:

I have setup the checkmk using docker and installed the caddy on ubuntu server without using docker, I mean directly on the native linux, I just have configured the Caddy file to include reverse proxy for checkmk but I can see caddy service is not active please suggest if there is any need of change in configuration file. Overall agenda is to run zabbix and checkmk as reverse proxy, if any links or any suggestions will be welcomed how to configure caddy as reverse proxy for monitoring environment

2. Error messages and/or full log output:

NA

3. Caddy version:

version- v2.7.6

4. How I installed and ran Caddy:

using caddy documentation for ubuntu

a. System environment:

Linux Prometheus-Server 5.4.0-125-generic #141-Ubuntu SMP Wed Aug 10 13:42:03 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

b. Command:

Default command of official caddy documentation

c. Service/unit/compose file:

didnot configured on docker

d. My complete Caddy config:

:443{
tls /etc/caddy/certificate/cert.pem /etc/caddy/certificate/key.pem
reverse_proxy http://127.0.0.1:8080

}

5. Links to relevant resources:

NA

Did you follow these instructions?

Read these afterwards:

You don’t need this, just configure Caddy with your actual domain name and it’ll automate issuance of TLS certs.

Hello francislavoie,

Thanks for the reply, Yah I have followed the steps given in the caddy documentation for installation, as per my observation when caddy is installed it was active and running but when configuration in caddy file was altered with the inclusion of checkmk configuration in the caddy file , then the caddy service was inactive, so as per my analysis the issue being part of caddy file configuration, so it will be great help if there is possible of tuning in any of the configuration file or any suggestion put forwarded. Below is the configuration file for Caddy file.

Note- The caddy is running in bare linux without docker or docker compose, and checkmk is running on docker and binded in port 8080

Thanks in advance

please below configuration of caddy file

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

:80 {
        # Set this path to your site's directory.
        root * /usr/share/caddy

        # Enable the static file server.
        file_server

        # Another common task is to set up a reverse proxy:
        # reverse_proxy localhost:8080

        # Or serve a PHP site through php-fpm:
        # php_fastcgi localhost:9000
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

:443{
tls /etc/caddy/certificate/cert.pem /etc/caddy/certificate/key.pem
reverse_proxy [http://127.0.0.1:8080](http://127.0.0.1:8080/)

}

It’s probably inactive because it failed to start due to a syntax error.

Did you check your logs? See the command in the docs I linked.

Delete all this. You’re meant to replace the whole config with your own. That’s just an example to present you with a welcome page, it shouldn’t be left in.

Don’t put :443, you should put your actual domain as the site address.

And you probably don’t already have your own TLS certificate, so don’t use the tls directive. Remove all that.

Make sure to read this page: Caddyfile Concepts — Caddy Documentation

Thanks,

Now I see Caddy is running, below is the caddy file configuration for it. Here my domain is checkmk.com, here question arises iam accessing the checkmk through http://local host:8080 but when I checked to access through https://local host:8080 iam not able to access the checkmk

Can I replace the domain name with ip and see or any further troubleshooting is necessary in configuration file, it will be great help what steps can be followed further to get it running

Thanks in advance

checkmk.com {
    reverse_proxy http://127.0.0.1:8080

}

or even if the caddy file can be altered to include then I can be able to access

:8080 {
reverse_proxy http://127.0.0.1:8080

}

Do you actually own that domain? You can’t just use a domain you don’t own.

I donot own that domain, is it the registered domain name is only option to have or any other possibilities

After thorough research and revalidation Iam able to run reverse proxy for uptime kuma, which can be accessible over https.

Now Iam trying to include combination of multiple reverse_proxy directives in the same block such as uptime kuma, zabbix and checkmk, will I be able to make and work over https, if it is so requesting to post a valid Caddy configuration file that includes all three uptime, zabbix and checkmk.

Thanks in advance

What did you try?

We’re not in the business of “doing the work for you”.

Show what you tried, ask specific questions about the problems you ran into.

Thanks for the reply, here is my Caddy configuration file

<my ip> {
    tls /etc/caddy/uptime.crt /etc/caddy/uptime.key
    reverse_proxy 127.0.0.1:3001
    # Checkmk reverse proxy
    reverse_proxy 127.0.0.1:9090
}

Although the configuration file is valid syntax-wise, it’s illogical. Consider this:

A request comes in, which reverse_proxy branch should Caddy execute? How should Caddy know the request is for :3001 or :9090?

These are questions you should define the answer for before crafting the configuration file.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.