Caddyfile for Zabbix?

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

As a systemd service installed following Caddy documentation

a. System environment:

Canonical-Ubuntu-22.04-2022.08.10-0

b. Command:

jason@srv:~$ systemctl status caddy

● caddy.service - Caddy
     Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-11-08 18:04:36 UTC; 2h 38min ago
       Docs: https://caddyserver.com/docs/
    Process: 4157 ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force (code=exited>
   Main PID: 3749 (caddy)
      Tasks: 8 (limit: 9451)
     Memory: 8.8M
        CPU: 503ms
     CGroup: /system.slice/caddy.service
             └─3749 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile```

c. Service/unit/compose file:

d. My complete Caddy config:

cld.private.com

root * /var/www/html
file_server

3. The problem I’m having:

I’d like to use Caddy instead of Apache or Nginx to serve up Zabbix, I saw another post in Caddy forums that is resolved but the user didn’t post the resulting Caddyfile

4. Error messages and/or full log output:

N/A

6. Links to relevant resources:

Looks like Zabbix is a PHP application. You’ll need to use php_fastcgi probably.

You should probably follow nginx installation instructions, then just swap in Caddy where they have you install nginx.

You’ll need to have php-fpm set up to run the PHP code I think, which should be covered by nginx installation instructions.

I don’t know whether they use a standard index.php routing setup, but it should just work if they do with the usual pattern of PHP configs in Caddy: Common Caddyfile Patterns — Caddy Documentation

2 Likes

I’m running Zabbix Server behind Caddy; here’s the Caddyfile:

{
        email admin@domain
        acme_ca https://ca.domain.org/acme/acme/directory
        acme_ca_root /etc/caddy/root_ca.crt
}

zabbix6.familybrown.org {

        encode gzip

        log {
                output file /var/log/caddy/zabbix_access.log
        }

        root * /usr/share/zabbix
        file_server

        php_fastcgi unix//run/php/php7.4-fpm.sock
}

I’m using a local CA, hence some of the directives in the global block

1 Like

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