Migrating Pi-Hole from lighttpd to apache

This is way outside the Pi-hole support. You need to do some research into basic linux commands. cd means change directory, and you can't cd into a file.

2 Likes

Here is a nice cheat sheet for a bunch of distro's though they are not the basic Linux commands :wink:

https://www.linuxcounter.net/toolbox/

Some other options like Nginx which seems to perform better than lighthttpd on raw performance and Caddy with SSL out-of-the-box might worth a shot with pi-hole.

1 Like

Thanks for the guide. After pointing to the correct Pi-hole web folder, apache2 can serve the pi hole admin console now. However, on the console, the web api version is missing. Only showing dev().
When doing sudo pihole -up, it shows web admin component is missing.
Any idea how to get this fixed?
And I believe in the lighthttpd config there’s error page redirect setting for ad block page. How to migrate that setting to Apache? Thanks.

I'm not quite sure I understand the moving part. Those directories are indeed where the Pihole script installed PiHole. Well, almost:
[root@galactica html]# ll

total 12
drwxr-xr-x 7 root root 4096 May 23 23:04 admin
-rw-r--r-- 1 lighttpd lighttpd 13 May 11 13:19 custom_disable_timer
drwxr-xr-x 2 root root 4096 May 23 23:04 pihole

You reference the /var/www/html/dns (instead of pihole) as the Document Root in your configuration. Where are you moving these directories/files to, and do you need to modify the .conf file afterwards?

I tried following the steps, but I'm not able to get it working quite yet on Fedora 29.

For the record, my Apache installation seems a bit different. Instead of one master 000-default.conf file, there are individual files for each web server, so for example, 1001-xyz.conf, 1002-abc.conf, 1005-pihole.conf.

I'm running:

[root@galactica html]# httpd -v
Server version: Apache/2.4.34 (Fedora)
Server built: Jul 20 2018 10:44:54

[root@galactica html]# php --version
PHP 7.1.23 (cli) (built: Oct 9 2018 15:37:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

Hi spedyq,

thanks a lot! You saved my day! :slight_smile: it was enough to just remove lighttpd and start apache. Then you could still start pi-hole with (locally) http://127.0.0.1/admin (for pi-hole) or http://127.0.0.1/cacti (for Cacti Monitoring).

Thanks.

Hi mr_master,

Good you got it working.
Also what helped me is running pihole -d from command line.
It will show you where you have differences with the default (lighttpd) setup; nothing to be worried about!

1 Like

Hi msatter,

You are right, it was just an example for my case. http://pi.hole/admin would be the correct one. Therefore I wrote (locally) before.

Regards.

@speedyq would you be interested in writing a guide for using apache for our docs page?

Similar to the existing ones for nginx, caddy, and traefik.

The repo for the docs site is here.

Cheers!

Hi PromoFaux,

I would have done this probably, but it has been way too long to remember what I have done installing apache and making it work with pihole because that was back then in 2016 I think.
The alternative would be for me to reinstall from scratch and create the installation guide along the way, but I don't have the proper hardware available to do so. And it should be a quality guide right?

Thank you. I was using my raspberry pi for ad blocking as well as an apache server. Just that I installed apache after installing pi hole. Everything worked fine until I updated my PiHole. Suddenly my apache stopped working and I had no clue what was wrong. I couldn't restart apache and the home page showed a template home page. I couldn't figure out which service was running. This thread made me realise it's actually lighttpd that has replaced my apache2. Uninstalled it and everything is working fine. Thanks!!

Hi Prasannjeet,

I think there is a way to stop running into this problem again.
You have to manually edit /etc/pihole/setupVars.conf.
In that file I have following parameters set as:
INSTALL_WEB_SERVER=false
LIGHTTPD_ENABLED=false
I think these prevent installing and using lighttpd on pihole update...

Thanks SpeedyQ, updated the conf files.