Port 80 in use by another program on the Pi, how do I configure Pi-Hole to use another port to serve up the admin page?
I just answered my own question.
I changed the web server port from 80 to 8017 in the lighttpd.conf file and then restarted the lighttpd service. Now I just type http://192.168.0.17:8017/admin/ in the browser to view the Admin Console page.
n6vmo is right. We have an FAQ covering this process.
Please be aware that new pihole version might overwrite these settings,
Not only might... Will!
this FAQ doesn't appear to be there any more?
I have a pi that already uses port 80 and need to have pi-hole using a different port.
Simply make a virtual IP, and configure pihole to use it. It's as easy as configuring a (second) static network IP.
Using a different port is not a choice, if not impossible, because if pihole's not listening on port 80, then block-page and transparent pixel will not be served in response to ads, and sites will take long time to finish loading. Transparent pixel example
curl http://zdbb.net/ads.jpg <html> <head> <script>window.close();</script></head> <body> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"> </body> </html>
The OP above didn't realize they had broken pihole even though pihole admin interface is accessible by a different port in the browser.
I am not sure that Pi-Hole is rendered useless or is broken by changing the port number for the web admin server in lighttpd.conf. My Pi has been running fine and blocking ads using port 8017. I have used several different ad-blocking test site and confirmed it does block ads while using a port other than 80 to serve up the admin page.
@n6vmo Sure, ads are blocked and it looks fine at first glance. But block-page and pixel server is rendered useless. You will likely see browser error or webpage not available if you go to for example http://scorecardresearch.com/ Normally it would load the block page
Also pixel blocking will be broken if you try "curl http://scorecardresearch.com/ads.jpg"
The Pi on the left is using port 80, while the Pi of the right is using port 8017. Not sure what pixel blocking is or its benefits.
My Pi' run headless, so I can't easily see what http://scorecardsearch.com displays.
If an ad gets replaced with a 404 page like the one on the right, you might see that page in place of the ad in the page. With the pixel blocking, the ad goes invisible.
Thank you for the information.
I'm using a synology NAS with chroot, how can I make another virtual IP address for just the pi?
There is a scenario where port 80 really needs to be left alone, I think: I have a webserver (caddy) front end which acts as reverse proxy for several sites, including pi-hole. So all requests not directed to a few specific domains still get passed on to pi-hole. I have pi-hole running on another port and proxy all unserved domains to it in caddy. It has been working fine for quite a while.
The only inconvenience is that whenever pi-hole gets updated (which is - applause! - very easy with curl + bash), the setup breaks because the port is set back to 80. I've made a note of it, but still get tripped up by this every time I do an update, months apart usually.
It would really be a nice improvement if the pi-hole update script could pick up the existing port and put it back after the update, before going to restart all the relevant services, etc. Given that it's detected as an update, surely the update script can safely assume that the existing setup was working properly?
I know the thread is pretty old, but I've got the same problem and wanted to ask for help.
Sadly I don't know how to make a virtual IP like @spacemonkey said, could you please help me?