Pihole on Pi3 behind Ngnix Windows Server issues

My Pihole has been setup and running fine for years, no issues with anything and had remote access to the admin page via port forwarding. Well recently I deployed a Ngnix proxy into my network to allow me to close the various open ports on my network and have all my web services run through it (sonarr, radarr, jackett, tautulli, etc). Everything works great, except for PiHole. I have it configured and can hit the dashboard, but the graphs do not load and once I click the login button I get a nice 404 error from ngnix. PiHole and Ngnix are not on the same box but on the same local network.

Please follow the below template, it will help us to help you!

Expected Behaviour:

Expected behavior is being able to access PiHole through Ngnix running on the same network but separate devices.

Actual Behaviour:

can get the main page, but graphs do not load and the login button returns a ngnix 404 error.

Here is the location block for Pihole I can post the entire thing if needed.
location /pihole/ {
proxy_pass http://192.168.1.2:80/admin/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}

Debug Token:

Since it's not an issue with Pihole running per say i did not include this.. but can if needed.

So as an update.. I have been able to make some progress. Adding the below gets the initial page to load correctly with the graphs displaying correctly. However now my issue is once I hit the login button things are still broken. I get a 404 ngnix error. and have tried the two location sections below.

Pihole Reverse Proxy main screen

location /pihole/ {
proxy_pass http://192.168.1.2/admin/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}

Pihole Reverse Proxy needed for graphs to display

location /pihole/api_db.php/ {
proxy_pass http://192.168.1.2:80/admin/api_db.php;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}

Pihole Reverse Proxy needed for graphs to display

location /pihole/api.php/ {
proxy_pass http://192.168.1.2/admin/api.php;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}

Test below and variations of the two and I ether get a 404 error from ngnix or will get a poorly loading login page with a URL redirection of pihole/index.php?/login and when it redirects to pihole/index.php?login it gives a 404.. I am at a loss.. am i missing something stupid.. been trying whatever I can find online but documentation is extremely limited

#Pihole Reverse Proxy
location /pihole/index.php {
proxy_pass http://192.168.1.2/admin/index.php
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}

Pihole Reverse Proxy

location /pihole/index.php?login/ {
proxy_pass http://192.168.1.2:80/admin/index.php?login/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
}

I will make a test tomorrow on this kind of setup.
My nginx is on the same box with one Pi-hole instance.

I’ll try pointing at a secondary one and see what happens.

What's even stranger is I have the main landing page working. The api working (some IFTTT and phone app uses it) but the actual login redirection page I cannot get working once it redirects to index.php?login I get an ngnix error page. So I'm sure I'm just doing something wrong but I've tried everything it seems.

Thanks for looking.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.