Monitorr Caddy Config

I am trying to get Monitorr (GitHub - Monitorr/Monitorr: "Monitorr” is a self-hosted PHP web app that monitors the status of local and remote network services, websites, and applications.) setup in Caddy. I have tried making it its own subdomain as well with no success. I am running Monitorr as a docker container. I can get to it just fine without Caddy.

I have tired

proxy /monitorr/ 192.168.1.100:8080/monitorr/ {
transparent
}
fastcgi / 127.0.0.1:9000 php

I also added transparent, without /monitrr/, and header_upstream X-Forwarded-Host {host}. I get a 404 file not found from nginx which is running in the container.

The developer provides an nginx config, but has no Caddy experience. Hoping someone here can help me translate the below into a working Caddy config.

    location /monitorr { 
        root c:/nginx/www;
        autoindex on;
        index index.php;
        location ~ .php$ {
            include        fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            }
        }

From what I see from the nginx config, you only need fastcgi.

fastcgi /monitorr 127.0.0.1:9000 php

Also, share your entire nginx and caddy config files.

I do not have nginx running. That was code from the app developer for Monitorr.

Here is the CaddyFile config.

The path to index.ph inside the docker container is ./config/www/monitorr/index.php. That directory is inside the container and the root for Caddy is outside the container (C:\Users\UserName\Documents\caddy\www). Not sure if I somehow how to link the 2 together, but I think that is the issue. Caddy does not know how to get to the index.php file as the root paths between the 2 are disjointed.

You don’t need FastCGI, or even site files. The docker container handles everything you need. You just want to put Caddy in front as a TLS terminating reverse proxy.

docker-compose.yml
version: '3'

services:
  caddy:
    image: abiosoft/caddy:latest
    command: ["-log", "stdout", "-agree",
      "-email", "letsencrypt@whitestrake.net",
      "-conf", "/etc/Caddyfiles/Caddyfile"]
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./certificates:/root/.caddy
      - ./caddyfiles:/etc/Caddyfiles
      - ./keys:/root/keys
      - ./sites:/srv
    restart: unless-stopped

  monitorr:
    image: monitorr/monitorr:latest
    environment:
      TZ: Brisbane/Australia
      PGID: 1000
      PUID: 1000
    volumes:
      - ./monitorr:/app
    restart: unless-stopped
Caddyfile
monitorr.whitestrake.net {
  proxy / monitorr {
    transparent
  }
}

Check https://monitorr.whitestrake.net for a demonstration of the above working configuration.

From my short testing, Monitorr is exceptionally friendly to subfolders. Just proxy from a subfolder directly to it, and it will work just fine, e.g. proxy /monitorr http://monitorr:80 should suffice.


If you DO want FastCGI (i.e., you want Caddy to serve Monitorr directly without running it in another container), you don’t want a proxy at all, just a volume mount for the site files inside the Caddy container.

3 Likes

I looked at my config and I am essentially doing what you are. It then dawned on me when I ran Monitorr it complained about the length of the folder structure so I moved it and never updated the mount volume. Updating my Docker mount point made a world of difference LOL. Thanks for the help!

1 Like

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