After installing Pi-Hole on an existing system with nginx and Baïkal (a CalDAV server), I cannot make the Pi-Hole admin interface work, there is always a 403 Forbidden error. Pi-Hole works well otherwise. I did not install lighttpd with Pi-Hole, preferring nginx.
Using strace, I found that nginx is failing after looking for several files that are absent. The files should be in /var/www/html/admin/ : index.html, index.htm and index.nginx-debian.html. The only similar file I have is index.php .
This page https://discourse.pi-hole.net/t/yesterdays-update-removed-the-index-html/60531/2 says that index.html was deliberately removed and: "You should have a automatic redirect when you access the web interface via pi.hole."
I cannot find anything helpful for this problem. How do I configure an automatic redirect in nginx?
Here is my nginx configuration file, taken from https://docs.pi-hole.net/guides/webserver/nginx/ :
server { listen 80; root /var/www/html; server_name $hostname; autoindex on; error_log /var/log/nginx/debug.log debug; index pihole/index.php index.php index.html index.htm; location / { expires max; try_files $uri $uri/ =404; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; fastcgi_pass unix:/run/php/php8.2-fpm.sock; fastcgi_param FQDN true; # auth_basic "Restricted"; # For Basic Auth # auth_basic_user_file /etc/ssl/.htpasswd; # For Basic Auth, same as Baikal } location /*.js { index pihole/index.js; # auth_basic "Restricted"; # For Basic Auth # auth_basic_user_file /etc/ssl/.htpasswd; # For Basic Auth, same as Baikal } location /admin { # Trying to get admin to work, try redirect rewrite ^/index.htm$ /index.php permanent ; root /var/www/html; index index.php index.html index.htm; # index index.php; # auth_basic "Restricted"; # For Basic Auth # auth_basic_user_file /etc/ssl/.htpasswd; # For Basic Auth, same as Baikal } location ~ /\.ht { deny all; } } Things I have tried
• autoindex off or on • Changing the index directive to just index.php • auth_basic active and removed • Adding a rewrite statement None of these made any difference.
One complication is that both Pi-Hole and Baïkal have a client called ‘admin’. I set both passwords the same, then removed the Pi-Hole password and finally removed the authentication (in Pi-Hole), all with no success.
There should be no conflicts between Pi-Hole and Baïkal. Baïkal listens on port 9999 and Pi-Hole uses 80.
System details
Raspberry Pi 3B with Pi OS bookworm, nginx and Baïkal, all new versions. Linux Mint desktop with Firefox.