Thanks! I just wanted to object because a location /
with proxy_pass http://127.0.0.1:8001/;
should reverse proxy all paths including /admin
...
But weirdly, this config works, setting up two separate reverse proxies for /admin
and /api
So this is the full config I now use:
server {
listen 192.168.0.1:80;
listen [::]:80 ;
server_name pi-hole.home;
location / {
return 301 $scheme://$host/admin/;
}
location /admin/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8001/admin/;
}
location /api/ {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8001/api/;
}
}
server {
# redirect non-standard TLD to proper domain
listen 192.168.0.1:80;
listen [::]:80 ;
server_name pi.hole;
location / {
return 301 $scheme://pi-hole.home/admin/;
}
}
So run pihole-FTL --config webserver.port "127.0.0.1:8001"
to not expose this port to the network interface(s) and you are done.
With v5 I didn't see a reason to have Pi-hole set up under /admin
, that's why I moved it to the root. But I don't insist on that, so I'm fine with the new setup.
So thanks for making me try out that way.