How can I use DNS challenge in Caddy2?

You need to build Caddy with DNS plugin support. See this recent thread where someone else got it working:

Right now, the official docker image doesn’t support building with custom plugins, but you can track the progress here: Allow customised Caddy builds by zakcutner · Pull Request #27 · caddyserver/caddy-docker · GitHub

Without additional context, your php_fastcgi directive looks correct to me. When running with docker-compose, you typically use the service name of the container you want to proxy to.


Edit: It seems like this was a popular thread in search results. Since this was written, some better options are available.

  • For non-docker setups, follow the instructions here:
    How to use DNS provider modules in Caddy 2

  • For docker, write a Dockerfile that uses the builder image. See the section on the Docker Hub docs titled “Adding custom Caddy modules” Docker and also reference this post to choose which plugin you’ll need.

1 Like