1. The problem I’m having:
I migrated CaddyFile from the old computer to the new computer to replace the web server.
But caddy doesn’t run. I get a Cloudflare error.
I don’t have a lot of software skills, so please excuse me if I’m asking unconventional questions.
(This post uses machine translation, there may be some parts that do not convey it. Thank you.)
2. Error messages:
2023/10/06 15:13:06.595 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": ""}
Error: adapting config using caddyfile: parsing caddyfile tokens for 'tls': /etc/caddy/Caddyfile:4 - Error during parsing: getting module named 'dns.providers.cloudflare': module not registered: dns.providers.cloudflare, import chain: ['']
3. Caddy version:
v2.7.4
Both the old and new servers are the same version.
4. How I installed and ran Caddy:
a. System environment:
Old server:
Linux Mint 20.3
New server:
Debian11
b. Command:
/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
I confirmed the above error with this command.
d. My complete Caddy config:
example.me, www.example.me {
root * /srv/www
tls {
dns cloudflare API_Token
}
file_server {
browse
}
php_fastcgi unix//run/php/php7.4-fpm.sock
}
API_Token is entered directly without using environment variables.
The domain name is the same for both the old and new servers.
Delete the “tls{~~}” part from Caddyfile, it will run without any problems.
5. :
The error message says “module not registered: dns.providers.cloudflare”, but this module was not included on the old server. (“caddy list-modules”)
I also installed this module on the new server, but the situation did not change. (Confirmed that it was installed by running “caddy list-modules”)
A friend helped me set up Caddy on the old server, so there may be other settings. (But that possibility is low.)
If there is a way to check it please let me know.
Please let me know if you need any other information.