Can't access /admin (another webpage running there already)


#1

Hi Folks,

I’ve just installed Pi-Hole on my NAS/Server.
However, I have my own (local) webpage that I use to manage my content.
This webpage is also using the [IP]/admin page and for some reason is being favoured instead of pihole.

Expected Behaviour:

Going to “[IP]/admin” shows the admin page of pihole.

Actual Behaviour:

It shows my own (local) webpage.

Debug Token:

I’d rather not at this point, unless specifically required.


The local content management webpage is actually made by a friend of mine and I don’t want to alter it (since I want to stay compatible to his project).

A valid solution would be:
192.168.2.10/admin (content management admin page)
192.168.2.10/pihole/admin (pihole admin page)

Or simply

192.168.2.10/admin (content management admin page)
192.168.2.10:1234/admin (pihole admin page)

I’m running NGINX as a webserver.
I’m thinking pihole should be under /srv/http/pihole and /etc/nginx/sites-available should have a configuration file for pihole on another port.

However, I’m not quite sure how I would go about this manually, the setup script seems to set up a lot of other things and I don’t even know where the root of pihole is set. (or why it’s not in the /srv/http folder


#2

If your NAS allows installing Docker as an addon/app/plugin, you can have Pi-hole running in a docker container with I believe its own IP address:

https://hub.docker.com/r/diginc/pi-hole/

Do mind that Pi-hole also comes with lighttpd as web service on the same port nginx is using for not only serving the admin page but also show an empty frame/page to replace ads on http sites when the ads get redirected via Pi-hole’s DNS.


#3

I believe I am mistaken.
Another solution is offered on that link:

If you have no other services or dockers using port 53/80 (if you do, keep reading below for a reverse proxy example)


#4

Hmm, so actually the chances are (very likely) that lighttpd is interfering (or going to) with my NGINX? Would it make sense to pursue the possibility to install PiHole on NGINX?

Nevertheless, my “NAS” is actually merely an Ubuntu Server installation with NFS shares and NGINX (also thinking of installing UniFi Manager, Node-RED and maybe Teamspeak Server).

The reason I’m not running Docker/VM is since it’s a baseline HP server (AMD Opteron X3216 with 8GB RAM) and I think it may use too much resources to split it over multiple instances.


#5

Yes.

If its Ubuntu, you can assign a second IP to the box using IP aliasing and bind daemons/services so you have lighttpd and nginx running alongside each other listening on same ports but on different IP’s.
Checkout this posting for pointers:

EDIT: Or if the box got another interface, hook up that one and bind daemons accordingly.


#6

Thank you very much for your input.
Your info made me aware of how pi-hole is set up.

For now I’ve changed the lighttpd port to 8899, so I shouldn’t interfere with NGINX and I can simply access it through 192.168.2.10:8899/admin.

May I ever make a public website, it also helps that people can’t access my pi-hole configuration (: (since I only ever would forward the port for NGINX)

I think this is a proper solution, let me know if that’s not the case.
I’m sorry since my question could’ve been: “How to change the port of lighttpd”, but at the time of writing I didn’t yet know this would be an option.


#7

Mind if you change the lighttpd port to a non default one, ads that are redirected to the box’s port 80 will end up being served by nginx resulting in 404 errors.
Thats why lighttpd is configured to reply on 404 errors with its own PHP code to show blank frame/page or a block page when a blacklisted domain is addressed directly in the browser.
Your missing out on that functionality now.

EDIT:

pi@noads:~ $ cat /etc/lighttpd/lighttpd.conf
server.document-root        = "/var/www/html"
server.error-handler-404    = "pihole/index.php"

#8

Ah I see, that’s indeed not as neat.
I think I’ll configure a virtual network interface and bind lighttpd to that.

My ISP’s supplied router for some reason doesn’t want me to set a different DNS (luckily I’m changing ISP in a few months).

So I’ve set my phone and laptop to pihole DNS, my laptop indeed gives 404-like errors (but that means it works as expected), however, my phone (chrome browser on android) is letting ads through.


#9

You can try see how the blockpage looks like by browsing to below link:

http://doubleclick.com:8899

Can replace routers DHCP with Pi-hole’s one:


#10

I get:
[ERROR]: Unable to parse results from queryads.php: Unhandled error message ()

Also, I actually checked, but the ISP’s router DHCP server can’t even be disabled… they use a prefab router but actually greyed out the enable/disable button… I can’t wait to get a different provider.

Though I must say that it’s a neat feature from pi-hole.


#11

Well it should have returned below or similar (no idea why the error):

Ps. search discourse for NGINX!
I believe there are postings how to configure nginx to host Pi-hole.
But if a Pi-hole update is applied to the lighttpd config, you understand it wont be pushed to nginx.


#12

I’ve just configured lighttpd to use port 80
And NGINX to use port 8888

This actually works fine for my purpose, also the error dissapeared and I now get a user-friendly blockpage.

Running them on different virtual interfaces (or just get a pi) should do the trick.

Also after restarting my phone, it now works on my phone as well.

Thank you very much!
I’ll have a look at virtual interfaces and binding them on lighttpd and NGINX, so far it has been very interesting/informative.

Now I reside to leaving bad reviews on my provider (’:

Thank you for your help once again, your support is much better as that of my provider. (I could only do those things when changing to a business connection and the person actually told me he didn’t know how/what settings would be required for using my own router. Mind I actually pay them a monthly subscription…)

I’ll make a paypal donation, if that helps/fits you.


#13

Love it :slight_smile:
One final remark, lighttpd has “mod_proxy” if its just plain http an not https that you’r hosting on nginx.


#14

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