From 37b7c9e6a7e4fa98e90256c7a0f8eef03c0be563 Mon Sep 17 00:00:00 2001 From: Twarner491 Date: Thu, 28 May 2026 14:31:30 -0700 Subject: [PATCH] fix(caddy): override php_fastcgi try_files to prefer index.html --- scripts/install_services.sh | 7 ++++--- scripts/update_caddyfile.sh | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/install_services.sh b/scripts/install_services.sh index d876405..44dc133 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -72,9 +72,10 @@ create_necessary_dirs() { # AvianVisitors overlay. The avian/ symlink keeps assets + PHP shims # reachable at /avian/. The five frontend files at the EXTRACTED root # make the collage the default index for http://birdnet.local/ - - # Caddy serves index.html before index.php, so BirdNET-Pi's stock UI - # moves to http://birdnet.local/index.php (still linked from the - # AvianVisitors menu drawer). + # the matching try_files override in update_caddyfile.sh teaches + # php_fastcgi to prefer index.html over index.php at the root, so + # BirdNET-Pi's stock UI moves to http://birdnet.local/index.php + # (still linked from the AvianVisitors menu drawer). if [ -d $my_dir/avian ]; then sudo -u ${USER} ln -fs $my_dir/avian ${EXTRACTED}/avian sudo -u ${USER} ln -fs $my_dir/avian/frontend/index.html ${EXTRACTED}/index.html diff --git a/scripts/update_caddyfile.sh b/scripts/update_caddyfile.sh index 3f5e701..02c5131 100755 --- a/scripts/update_caddyfile.sh +++ b/scripts/update_caddyfile.sh @@ -37,7 +37,13 @@ http:// ${BIRDNETPI_URL} { birdnet ${HASHWORD} } reverse_proxy /stream localhost:8000 - php_fastcgi unix//run/php/php-fpm.sock + # AvianVisitors overlay drops an index.html alongside BirdNET-Pi's + # index.php. The default try_files for php_fastcgi prefers index.php + # over index.html, so override it - this is a no-op on stock installs + # since EXTRACTED has no index.html there. + php_fastcgi unix//run/php/php-fpm.sock { + try_files {path} {path}/index.html {path}/index.php index.php + } reverse_proxy /log* localhost:8080 reverse_proxy /stats* localhost:8501 reverse_proxy /terminal* localhost:8888 @@ -55,7 +61,13 @@ http:// ${BIRDNETPI_URL} { file_server browse } reverse_proxy /stream localhost:8000 - php_fastcgi unix//run/php/php-fpm.sock + # AvianVisitors overlay drops an index.html alongside BirdNET-Pi's + # index.php. The default try_files for php_fastcgi prefers index.php + # over index.html, so override it - this is a no-op on stock installs + # since EXTRACTED has no index.html there. + php_fastcgi unix//run/php/php-fpm.sock { + try_files {path} {path}/index.html {path}/index.php index.php + } reverse_proxy /log* localhost:8080 reverse_proxy /stats* localhost:8501 reverse_proxy /terminal* localhost:8888