Replacing nginx with caddy

phonesimon

Member
Apr 21, 2017
87
15
8
42
I set up FusionPBX (latest git) on Debian 11 with some mild difficulty but stepping through the install script got me a working system. In the process I got to inspect the various components and was considering the web server.

Lately I have enjoyed using caddy (caddyserver.com) for other projects because it is simple and really fast (not necessarily faster than nginx, probably the same). Moreover, it handles TLS certificate acquisition with ZeroSSL or Let's Encrypt behind the scenes, automatically.

Simple Caddyfile config works with good defaults (auto fetch TLS cert, redirect HTTP to HTTPS, handles php)

Code:
my.domain.example.com {
    root * /var/www/fusionpbx
    php_fastcgi unix//var/run/php/php7.4-fpm.sock
    file_server
}

This gets me an HTTPS admin site with scripts and static assets working.

For provisioning there are a lot of rewrites needed and some exceptions to allow HTTP calls rather than HTTPS. Some of the fine tuning in the nginx config probably needs to be applied here too. I plan to keep working at this to produce an equivalent caddy config to what Mark has done with nginx. Chime in on this thread if you're interested and/or want to help.