Hey there,
after upgrading Pi-hole to v6, I can't reach the webinterface behind a nginx reverse proxy anymore.
I use nginx, because I have more web services running on the Pi-hole box, so I configure them to different ports, and reverse-proxy them to an internal hostname, e.g. pi-hole.home
for my Pi-hole instance.
For v5 I configured lighttpd
to localhost:
server.port = 8001
server.bind = "127.0.0.1"
and used this nginx config for years which worked like a charm:
server {
listen 192.168.0.1:80;
listen [::]:80 ;
server_name pi-hole.home;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8001/admin/;
}
location /admin/ {
return 301 $scheme://$host/;
}
}
Now after update, I can't get this to work.
I already figured out with this post to run
pihole-FTL --config webserver.port 8001
to get back "my" port.
But this now ends in a redirect loop:
- http://pi-hole.home/ replys with 302 Found http://pi-hole.home/admin/login
- http://pi-hole.home/admin/login replys with 301 Moved Permanently http://pi-hole.home/ (because of my second rule which was needed for some faulty v5 redirects)
So I stripped down the config to just do a plain reverse proxy:
server {
listen 192.168.0.1:80;
listen [::]:80 ;
server_name pi-hole.home;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8001/;
}
}
Which ends in a different situation: http://pi-hole.home/ replys with 403 Forbidden, and nearly all script/stylesheet requests (except /admin/vendor/datatables/
, /admin/vendor/daterangepicker/
and /admin/vendor/bootstrap-toggle/
) return a 301 Moved Permanently to http://pi-hole.home/
This results in black text on black background:
Which basically wants to tell me:
So how can I get my configuration to work?
It seems as other users got it to work with a lighttpd reverse proxy config.
PS: http://pi.hole:8001/ works, but that's not the url I want it to be at.