Installing apache2 stops pihole web page from loading

The issue I am facing:
I started with a fresh sd card with clean RaspiOS bookworm 64 bit installed.
I did an update and a full-upgrade
I set a fixed IP address

I installed pihole
Changed that one line in pihole.toml to
port = "8888,443os,[::]:8888o,[::]:443os"
I rebooted and pihole web page was available on http://192.168.0.110:8888/admin/

So far so good

I then installed apache2 and php8.2
I added to /etc/apache2/sites-enabled/000-default.conf the virtual host for :8080

\<VirtualHost *:8080\>
        ServerAdmin webmaster@localhost
        DocumentRoot "/var/www/html/flexylist/public"
        \<Directory "/var/www/html/flexylist/public"\>
            AllowOverride All
            Require all granted
        \</Directory\>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
\</VirtualHost\>

I added Listen 8080 to /etc/apache2/ports.conf
I rebooted

I opened http://192.168.0.110:8888/admin/
and saw
Error 404: Not Found
Not found

As I understand it, and as does work on another pi that I'm running pihole on, apache2 should serve on :80 and :8080 and pihole's built-in server should serve on :8888

Where am I going wrong, please?

Details about my system:
RaspberryPi Zero 2W
Fresh sd card with clean RaspiOS bookworm 64 bit installed
What I have changed since installing Pi-hole:
Installed apache2 and php8.2, enabled virtual host for port:8080 (for another app I'll set up later)

Please share the output of:

ls -lah /var/www
ls -lah /var/www/html/admin

And please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or if you run your Pi-hole as a Docker container:

docker exec -it <pihole-container-name-or-id> pihole -d

where you substitute <pihole-container-name-or-id> as required.

Thanks for this. Here's what I get:

ls -lah /var/www
total 12K
drwxr-xr-x  3 www-data www-data 4.0K Apr 24 22:49 .
drwxr-xr-x 12 root     root     4.0K Apr 24 22:49 ..
drwxrwx---  3 www-data www-data 4.0K Apr 25 18:56 html
ls -lah /var/www/admin
ls: cannot access '/var/www/admin': No such file or directory

which I can see from WinSCP is true

I guess that's a typo, so

ls -lah /var/www/html/admin
total 632K
drwxr-xr-x  9 root     root     4.0K Apr 25 18:56 .
drwxrwx---  3 www-data www-data 4.0K Apr 25 18:56 ..
-rw-r--r--  1 root     root       17 Apr 25 18:56 .codespellignore
-rw-r--r--  1 root     root     2.3K Apr 25 18:56 CONTRIBUTING.md
drwxr-xr-x  2 root     root     4.0K Apr 25 18:56 .devcontainer
-rw-r--r--  1 root     root      571 Apr 25 18:56 .editorconfig
-rw-r--r--  1 root     root     1.1K Apr 25 18:56 error403.lp
-rw-r--r--  1 root     root      969 Apr 25 18:56 error404.lp
drwxr-xr-x  8 root     root     4.0K Apr 25 18:56 .git
-rw-r--r--  1 root     root       43 Apr 25 18:56 .gitattributes
drwxr-xr-x  4 root     root     4.0K Apr 25 18:56 .github
-rw-r--r--  1 root     root      154 Apr 25 18:56 .gitignore
-rw-r--r--  1 root     root     1.3K Apr 25 18:56 gravity.lp
-rw-r--r--  1 root     root     4.9K Apr 25 18:56 groups-clients.lp
-rw-r--r--  1 root     root     8.7K Apr 25 18:56 groups-domains.lp
-rw-r--r--  1 root     root     4.5K Apr 25 18:56 groups-lists.lp
-rw-r--r--  1 root     root     3.3K Apr 25 18:56 groups.lp
drwxr-xr-x  3 root     root     4.0K Apr 25 18:56 img
-rw-r--r--  1 root     root      11K Apr 25 18:56 index.lp
-rw-r--r--  1 root     root     1.2K Apr 25 18:56 interfaces.lp
-rw-r--r--  1 root     root      14K Apr 25 18:56 LICENSE
-rw-r--r--  1 root     root     7.6K Apr 25 18:56 login.lp
-rw-r--r--  1 root     root     1.6K Apr 25 18:56 messages.lp
-rw-r--r--  1 root     root     2.8K Apr 25 18:56 network.lp
-rw-r--r--  1 root     root     4.0K Apr 25 18:56 package.json
-rw-r--r--  1 root     root     335K Apr 25 18:56 package-lock.json
-rw-r--r--  1 root     root      144 Apr 25 18:56 postcss.config.js
-rw-r--r--  1 root     root     9.7K Apr 25 18:56 queries.lp
-rw-r--r--  1 root     root      10K Apr 25 18:56 README.md
drwxr-xr-x  4 root     root     4.0K Apr 25 18:56 scripts
-rw-r--r--  1 root     root     2.2K Apr 25 18:56 search.lp
-rw-r--r--  1 root     root     1.5K Apr 25 18:56 settings-all.lp
-rw-r--r--  1 root     root      15K Apr 25 18:56 settings-api.lp
-rw-r--r--  1 root     root      21K Apr 25 18:56 settings-dhcp.lp
-rw-r--r--  1 root     root      18K Apr 25 18:56 settings-dns.lp
-rw-r--r--  1 root     root     7.0K Apr 25 18:56 settings-dnsrecords.lp
-rw-r--r--  1 root     root     7.1K Apr 25 18:56 settings-privacy.lp
-rw-r--r--  1 root     root      19K Apr 25 18:56 settings-system.lp
-rw-r--r--  1 root     root     6.5K Apr 25 18:56 settings-teleporter.lp
drwxr-xr-x  3 root     root     4.0K Apr 25 18:56 style
-rw-r--r--  1 root     root     1.5K Apr 25 18:56 taillog.lp
drwxr-xr-x 29 root     root     4.0K Apr 25 18:56 vendor

https://tricorder.pi-hole.net/qWUawArH/

It would seem that Apache changes ownership of directories to www-data.

Please try adding Pi-hole's pihole user to www-data:

sudo usermod -aG www-data pihole

Please report back - if your issue persists despite that change, we may also have to adjust permissions.

That did it!

Thanks a lot.

And I went back to the sd card holding the installation referred to in this:

made the same change and that also now gives access to the pihole web page

Again - much appreciated.

1 Like