I managed to install a lets encrypt certificate and after connecting to the raspberry, I saw the apache welcome page instead of the birdnetpi caddy page.
Then I followed this solution:
sudo systemctl stop apache2
sudo systemctl disable apache2
# Check which version of php-fpm is installed
ls /run/php
php8.2-fpm.pid php8.2-fpm.sock php-fpm.sock
# edit the Caddy config file to point to this version
sudo vi /etc/caddy/Caddyfile
#
# old
# php_fastcgi unix//run/php/php7.4-fpm.sock
#
# new
# php_fastcgi unix//run/php/php8.2-fpm.sock
#
# Confirm the caddy user is unable to read the index file
sudo -u caddy ls -lrta /home/pi/BirdSongs/Extracted/index.php
# fix the permissions
sudo chmod -R g+rx /home/pi
# it should work now
sudo -u caddy ls -lrta /home/pi/BirdSongs/Extracted/index.php
# now restart the failed caddy service
sudo systemctl start caddy
I get then the following errors:
systemctl status caddy.service
× caddy.service - Caddy
Loaded: loaded (/lib/systemd/system/caddy.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/caddy.service.d
└─override.conf
Active: failed (Result: exit-code) since Mon 2025-06-23 15:29:29 CEST; 6min ago
Docs: https://caddyserver.com/docs/
Process: 2014 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile (code=exited, status=1/FAILURE)
Main PID: 2014 (code=exited, status=1/FAILURE)
Status: "loading new config: http app module: start: listening on :80: listen tcp :80: bind: address already in us>
CPU: 183ms
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.36629,"logger":"http.auto_https","msg":"server >
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3663824,"logger":"http.auto_https","msg":"enabl>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3679144,"logger":"tls.cache.maintenance","msg":>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3813195,"logger":"http","msg":"enabling HTTP/3 >
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3818297,"logger":"http.log","msg":"server runni>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3921013,"msg":"maxprocs: No GOMAXPROCS change t>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: Error: loading initial config: loading new config: http app module: start: list>
Jun 23 15:29:29 birdnetpi1 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Jun 23 15:29:29 birdnetpi1 systemd[1]: caddy.service: Failed with result 'exit-code'.
Jun 23 15:29:29 birdnetpi1 systemd[1]: Failed to start caddy.service - Caddy.
journalctl -xeu caddy.service
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.36629,"logger":"http.auto_https","msg":"server >
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3663824,"logger":"http.auto_https","msg":"enabl>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3679144,"logger":"tls.cache.maintenance","msg":>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3813195,"logger":"http","msg":"enabling HTTP/3 >
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3818297,"logger":"http.log","msg":"server runni>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3921013,"msg":"maxprocs: No GOMAXPROCS change t>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: Error: loading initial config: loading new config: http app module: start: list>
Jun 23 15:29:29 birdnetpi1 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStart= process belonging to unit caddy.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Jun 23 15:29:29 birdnetpi1 systemd[1]: caddy.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit caddy.service has entered the 'failed' state with result 'exit-code'.
Jun 23 15:29:29 birdnetpi1 systemd[1]: Failed to start caddy.service - Caddy.
░░ Subject: A start job for unit caddy.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit caddy.service has finished with a failure.
░░
░░ The job identifier is 1572 and the job result is failed.
...skipping...
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"warn","ts":1750685369.3560827,"logger":"config.adapter.caddyfile","ms>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3595297,"msg":"adapted config to JSON","adapter>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3650362,"logger":"admin","msg":"admin endpoint >
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.36629,"logger":"http.auto_https","msg":"server >
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3663824,"logger":"http.auto_https","msg":"enabl>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3679144,"logger":"tls.cache.maintenance","msg":>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3813195,"logger":"http","msg":"enabling HTTP/3 >
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3818297,"logger":"http.log","msg":"server runni>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: {"level":"info","ts":1750685369.3921013,"msg":"maxprocs: No GOMAXPROCS change t>
Jun 23 15:29:29 birdnetpi1 caddy[2014]: Error: loading initial config: loading new config: http app module: start: list>
Jun 23 15:29:29 birdnetpi1 systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An ExecStart= process belonging to unit caddy.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Jun 23 15:29:29 birdnetpi1 systemd[1]: caddy.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ The unit caddy.service has entered the 'failed' state with result 'exit-code'.
Jun 23 15:29:29 birdnetpi1 systemd[1]: Failed to start caddy.service - Caddy.
░░ Subject: A start job for unit caddy.service has failed
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ A start job for unit caddy.service has finished with a failure.
░░
░░ The job identifier is 1572 and the job result is failed.
lines 179-207/207 (END)
Why does caddy not start anymore?
'''