Hello PromoFaux and DL6ER,
Until I have a final solution, I am "not going" to disagree to both of you. Because both of you opposed to my opinion, I am now at the set back until I can prove the opposite. Now, I am only going to share my opinion. When I have a final working solution, I will proceed to make a pull request.
So, please allow me to express my opinion to show where and why I disagree to both of you.
In the above steps mentioned by DL6ER from 1 - 6, that part I agree.
Between the step 6 - 7, DL6ER has gulped something very important here:
The control of data streams on the server.
This can only be true, if and only if the following conditions are true:
A. If a default port 80 is defined in the lighttpd.conf.
B. Port 80 is not defined in the lighttpd.conf. (You can happily remove it!)
Then, lighttpd will default to port 80. Why? Because it is hard-coded in the binaries.
It is your decision to define the port for lighttpd services. If you want to have lighttpd daemon to generate a page on port - for e.g. 2096 - here, then configure it. With this, you override the internal default port 80.
I can produce a block page for a blocked domain - manually - on any port you tell me.
However, what I do not know is to connect the data streams between dnsmasq and lighttpd. This, I could only if I study the pi-Hole php scripts. Then I may know how these data streams are captured and how they could be compelled to generate on any port.
Once that is done, then one could really have a dedicated daemon lighttpd for pi-Hole. THATS GOING TO BE EXCELLENT, RIGHT? Thereafter, no checks for any web servers are required, which the poster of this thread wanted. He posted to address the problem because it is caused. I give a solution not to eradicate the problem but to eradicate the root cause of this problem fundamentally.