I am not certain if it would be possible to leverage the ‘built-in’ web server, as it’s meant for Pi-hole only. I use lighttpd myself. Since the v5 Pi-hole used to install and use that, over the years I added on functionality needing/using that web server. In the now v6 days, I migrated my setup to still use lighttpd and proxy to both the Pi-hole interface and APIs as well as act as a reverse proxy for DoH. My lighttpd also serves up basic error and landing pages as well as rpimonitor. It’s light-weight and can provide many mods for specific needs.
So the best is to install Apache next to Pi Hole?
I'm not sure if this will work.
Civetweb can run PHP, but our embedded version doesn't have any specific configuration to execute PHP files. I never tried to run PHP using pihole-FTL web server. Also, I never heard about other users successfully doing it.
You can try it, but I think using apache or nginx to run PHP will probably be easier.
So how to install Apache next to Pi Hole
Yesterday, I answered a very similar question, on Reddit:
If you want to run Pi-hole and another web server at the same time, you need to install the other web server, then use different ports for each of them.
Examples:
- Pi-hole using ports
80and443and Apache using other ports, like8880and8443or - Apache using ports
80and443and Pi-hole using other ports, like8080and8443.
Note:
If you want to change Pi-hole settings to use custom ports, run this command:
sudo pihole-FTL --config webserver.port '8080o,8443so'
thanks you for your help
ok but so example I just installed pi hole, then install apache "sudo apt install apache2" modify the ports.conf file of apache by listening on ports 8080 and 8443 and is it okay?
The command above will change Pi-hole ports.
Pi-hole web interface will use ports 8080 and 8443. Then you will need to access the web interface using these ports:
Apache will use whatever ports you like (the default ones are 80 and 443).
ok thanks
I'm a little confused. Should I use a reverse proxy? Should I use Docker?
I think you are...
You can use a Reverse proxy, you can use Docker and you can use both at the same time...
They are completely different solutions, to different problems:
A reverse proxy handles how you will connect to a domain. A reverse proxy is a server that sits in front of web servers, acting as an intermediary between the browser and the web server, usually forwarding connections to different ports.
Docker will run Pi-hole (and also a reverse proxy, if you want it) inside containers.
ok so if I just want a small local website (that uses php) on the same PI as pi hole, how do I do it?
This is 100% unrelated to Pi-hole.
Search how to install Apache and PHP on your OS (this is out of scope here).
Then you execute the command I gave you above:
sudo pihole-FTL --config webserver.port '8080o,8443so'
And access Pi-hole web interface using this URL: http://pi.hole:8080/admin
The other website (your PHP web site) will be accessed using the port you configure on Apache.
ok thank you I'll try
its work, thank you bro