Using BirdNet-Pi with https

1. The problem I’m having:

Birdnet-Pi uses caddy but only http access is configured. I’d like to use https instead.

2. Error messages and/or full log output:

no error message, https don't work

3. Caddy version:

caddy version v2.10.0 h1:

4. How I installed and ran Caddy:

I did the birdnet-pi installation as described here:

a. System environment:

Raspberry Pi OS Lite 64bit

b. Command:


c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

sudo more /etc/caddy/Caddyfile
http:// {
        root * /home/birder/BirdSongs/Extracted
        file_server browse
        handle /By_Date/* {
                file_server browse
        }
        handle /Charts/* {
                file_server browse
        }
        basicauth /views.php?view=File* {
                birdnet $2a$14$GifbyTv9vm1CrnVFXI9B5OLPWY.04aFErIWQ6HbBRhJb7KGRw81/O
        }
        basicauth /Processed* {
                birdnet $2a$14$GifbyTv9vm1CrnVFXI9B5OLPWY.04aFErIWQ6HbBRhJb7KGRw81/O
        }
        basicauth /scripts* {
                birdnet $2a$14$GifbyTv9vm1CrnVFXI9B5OLPWY.04aFErIWQ6HbBRhJb7KGRw81/O
        }
        basicauth /stream {
                birdnet $2a$14$GifbyTv9vm1CrnVFXI9B5OLPWY.04aFErIWQ6HbBRhJb7KGRw81/O
        }
        basicauth /phpsysinfo* {
                birdnet $2a$14$GifbyTv9vm1CrnVFXI9B5OLPWY.04aFErIWQ6HbBRhJb7KGRw81/O
        }
        basicauth /terminal* {
                birdnet $2a$14$GifbyTv9vm1CrnVFXI9B5OLPWY.04aFErIWQ6HbBRhJb7KGRw81/O
        }
        reverse_proxy /stream localhost:8000
        php_fastcgi unix//run/php/php-fpm.sock
        reverse_proxy /log* localhost:8080
        reverse_proxy /stats* localhost:8501
        reverse_proxy /terminal* localhost:8888
}

5. Links to relevant resources:

Replace the http:// { line (the first line) by your desired hostname when the website is ran using https, eg: netbird.example.com {

1 Like

Thank you @ferrybig

I did this, but could not connect. I read something about a selfsigned certificate for caddy. Is this installed by default or should I get a lets encrypt one?

I have another Raspberry with a lets encrypt certificate running on apache webserver, that works well. However, on that Raspberry there is no carry installed.

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?
'''