# Pi-Hole Install Crashes Nginx

**URL:** https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960
**Category:** Troubleshooting
**Created:** [15 February 2023 01:03 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960 "2023-02-15T01:03:54Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![Trimble-tech](https://dietpi.com/forum/user_avatar/dietpi.com/trimble-tech/32/3451_2.png) [@Trimble-tech](https://dietpi.com/forum/u/Trimble-tech)
#### Post date: [15 February 2023 01:03 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/1 "2023-02-15T01:03:54Z")

</div>

### Creating a bug report/issue

#### Required Information

- DietPi version | `G_DIETPI_VERSION_CORE=8 G_DIETPI_VERSION_SUB=14 G_DIETPI_VERSION_RC=2 G_GITBRANCH='master' G_GITOWNER='MichaIng' G_LIVE_PATCH_STATUS[0]='not applicable'`

- Distro version | `bullseye 0`

- Kernel version | `Linux Piper 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux`

- SBC model | `RPi 4 Model B (aarch64)`

- Power supply used | RPi Official USB-C

- SD card used | none; 1TB Sata 2.5" (enclosed) used.

#### Additional Information (if applicable)

- **Software title** | Pi-Hole
- **Was the software title installed freshly or updated/migrated?**  
It is a clean install from DietPi-Software
- **Can this issue be replicated on a fresh installation of DietPi?**  
Yes  
 ← If you sent a “dietpi-bugreport”, please paste the ID here → 
- Bug report ID | 71209e97-3862-4cca-ba50-e60a1de6f031

#### Steps to reproduce

1. Install Pi-Hole with Nginx, alone or with companion like Nextcloud
2. Install Unbound with it, as choice during Pi-Hole install

#### Expected behaviour

- Pi-Hole creates correct Nginx config/doesn’t break anything
- Pi-Hole and other services are available through Nginx

#### Actual behaviour

- Pi-Hole Installation breaks NGINX functionality, nothing is available
- Nginx and all other services function again upon removal of Pi-Hole

#### Extra details

- `sudo nginx -t` responds with:` nginx: [emerg] unknown "frame_option" variable`
- Pi-Hole script prompts to uninstall these packages: `git iproute2 dialog ca-certificates cron curl iputils-ping psmisc sudo unzip idn2 libcap2-bin dns-root-data libcap2 netcat-openbsd procps jq grep dnsutils`
- If Pi-Hole is allowed to uninstall stated packages (above), system (sometimes) breaks and needs full reinstall. We really shouldn’t be removing things like `sudo`, `dialog`, or others…
- No issues seem to occur if the chosen web-server is Apache; this is an issue dependent on Nginx. I like Nginx…

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [15 February 2023 07:10 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/2 "2023-02-15T07:10:11Z")

</div>

Pihole deletes packages when you install it?  
I only know about their uninstall script, which deletes a lot of stuff if you are not careful

> [@Possible Bug when uninstalling PiHole](https://dietpi.com/forum/t/possible-bug-when-uninstalling-pihole/6243/2):
>
> This is a really bad behaviour of PiHole uninstall script (not DietPi). We tried to convince PiHole devs to remove this question or change it into an information only. But without success unfortunately. You are not the first one and you will not be last [https://dietpi.com/forum/t/dietpi-fail-to-find-eithernet-connection-at-boot-time/5254/1](https://dietpi.com/forum/t/dietpi-fail-to-find-eithernet-connection-at-boot-time/5254/1)[https://dietpi.com/forum/t/removal-of-pi-hole-removed-ip-command-stuck-in-boot-net-wait/4976/1](https://dietpi.com/forum/t/removal-of-pi-hole-removed-ip-command-stuck-in-boot-net-wait/4976/1) PiHole GitHub issue [https://github.com/pi-hole/pi-hole/issu…](https://github.com/pi-hole/pi-hole/issues/3929)

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [15 February 2023 08:05 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/3 "2023-02-15T08:05:01Z")

</div>

there seems to be a bug introduced with latest version.

As workaround go into `/etc/nginx/sites-dietpi/dietpi-pihole.conf` and disable following 2 options.

```auto
#	set $frame_options "deny";
#	add_header X-Frame-Options "$frame_option";

```

Restart Nginx afterwards

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [15 February 2023 15:04 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/4 "2023-02-15T15:04:04Z")

</div>

Uncomment those two lines again and replace `frame_option` with `frame_options` (“s” was missing).

I fixed the config in our master branch (from where it is downloaded on install), so a reinstall or fresh install of Pi-hole will now also have it fixed.

Many thanks for reporting 👍.

---

<div class="post-metadata">

### Author: ![Trimble-tech](https://dietpi.com/forum/user_avatar/dietpi.com/trimble-tech/32/3451_2.png) [@Trimble-tech](https://dietpi.com/forum/u/Trimble-tech)
#### Post date: [15 February 2023 16:01 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/5 "2023-02-15T16:01:01Z")

</div>

The Pi-Hole script gives the option to remove packages on uninstall that are listed as dependencies. This is in nature good, but the list of dependencies is large and can remove things like `sudo`. I think we should “fool-proof” this a little more for those not looking, and possibly remove some of the packages from the list.

---

<div class="post-metadata">

### Author: ![Trimble-tech](https://dietpi.com/forum/user_avatar/dietpi.com/trimble-tech/32/3451_2.png) [@Trimble-tech](https://dietpi.com/forum/u/Trimble-tech)
#### Post date: [15 February 2023 16:03 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/6 "2023-02-15T16:03:17Z")

</div>

Thanks; I installed everything this morning fresh and it works now.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [15 February 2023 16:19 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/7 "2023-02-15T16:19:42Z")

</div>

> [@Trimble-tech](#):
>
> think we should “fool-proof” this a little more for those not looking, and possibly remove some of the packages from the list.

This is an issue at PiHole side and out of our scope. We tried to convince them to change but without success

> <https://github.com/pi-hole/pi-hole/issues/3929>
>
> \### Expected behavior
> 
> We should know what packages we installed and only sugg…est/list those packages for removal.
>  
> \### Actual behavior / bug
> 
> Shotgun is loaded and handed to user. Collateral damage ensues.
> 
> \### Additional context
> 
> Investigate \`apt-mark\` to mark dependencies we installed as manual, then the uninstaller can list the manually installed packages, leave the autoinstalled or installed prior to Pi-hole alone. 
> 
> http://manpages.ubuntu.com/manpages/bionic/man8/apt-mark.8.html#automatically%20and%20manually%20installed%20packages

---

<div class="post-metadata">

### Author: ![Trimble-tech](https://dietpi.com/forum/user_avatar/dietpi.com/trimble-tech/32/3451_2.png) [@Trimble-tech](https://dietpi.com/forum/u/Trimble-tech)
#### Post date: [16 February 2023 00:03 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/8 "2023-02-16T00:03:20Z")

</div>

Okay, thanks for letting me know. I am glad that DietPi already investigated this.

---

<div class="post-metadata">

### Author: ![urostor](https://dietpi.com/forum/user_avatar/dietpi.com/urostor/32/1891_2.png) [@urostor](https://dietpi.com/forum/u/urostor)
#### Post date: [4 March 2023 16:38 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/9 "2023-03-04T16:38:48Z")

</div>

Hello. Sorry for bringing this up again but it seems that my pihole and nginx don’t like each other.

- I can access the pihole user interface by going to pi.hole/admin, but can’t from 192.168.[restofip]/admin. Also my nextcloud stopped working (yesterday?) which I think is connected to this.

I tried reinstalling both, without success.

Let me know what else I can show…

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [4 March 2023 17:01 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/10 "2023-03-04T17:01:07Z")

</div>

There is no real relation between PiHole and Nginx. PiHole web interface is a simple web app, like Nextcloud, that require a web server like Apache or Nginx to be able to be displayed. As you are able to reach `pi.hole/admin` indicates the web server running and working. Otherwise, this would be failing as well. How do you try reaching NC? Did you activate any special setting on your web server? What changed the last days that could be related to your issue?

---

<div class="post-metadata">

### Author: ![urostor](https://dietpi.com/forum/user_avatar/dietpi.com/urostor/32/1891_2.png) [@urostor](https://dietpi.com/forum/u/urostor)
#### Post date: [4 March 2023 21:52 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/11 "2023-03-04T21:52:51Z")

</div>

That’s the million euro question… Of the more substantial things I did:

- installed arp-scan (uninstalled it now)
- installed and configured Navidrome (stopped and disabled the service now).
- there were some updates to PHP (7.4)

And right now I can’t get to [http://pi.hole/admin](http://pi.hole/admin) any more. Really not sure why. I know pihole is running since all my DNS domains work, so it’s just nginx. Trying to reinstall PHP now using `dietpi-software reinstall 89`.

But I doesn’t seem to be possible to run nginx in interactive mode…

OK, we’re getting somewhere. After reinstalling PHP, nginx failed to start:  
`nginx[11576]: nginx: [emerg] bind() to 0.0.0.0:80 failed(98: Address already in use)`. Reinstalling nginx using dietpi-software did not help.  
I then purged nginx using dietpi-software and then installed it again - still it was failing to run.

I saw that one of my devices (projector) was connected to dietpi (by its standby wifi) using port 80 without nginx running. Turned it off; this did not help at all.

After rebooting when all of these things were done, nginx got up. Pihole did too but it did not work. `pihole -d` returned these errors:

1. [✗] tcp:0.0.0.0:80 is in use by nginx ([Prerequisites - Pi-hole documentation](https://docs.pi-hole.net/main/prerequisites/#ports))
2. `[✗] Web interface X-Header: X-Header does not match or could not be retrieved. HTTP/1.1 302 Found Server: nginx Date: Sat, 04 Mar 2023 21:25:58 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache Set-Cookie: PHPSESSID=06d9vosk2fmkd1lvtafn8n7dst; path=/; HttpOnly; SameSite=Strict Location: login.php `  
And some irrelevant errors for lighttpd (which doesn’t exist).  
Error 2 is related to what you wrote above, so then I tried editing the lines again, but found `/etc/nginx/sites-dietpi` to be empty. I copied the needed nginx conf files from a backup (those without the need to edit them already) and error 2 disappeared, but error 1 stayed.

The error when I was trying to go to pi.hole/admin is “DNS\_PROBE\_FINISHED\_NXDOMAIN” and if by IP it is “ERR\_CONNECTION\_REFUSED”.

Right now I think it’s something connected to pihole’s webserver and nginx’s webserver fighting each other for port 80, but I really don’t know a lot about networking.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [4 March 2023 22:07 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/12 "2023-03-04T22:07:07Z")

</div>

> [@urostor](#):
>
> Right now I think it’s something connected to pihole’s webserver and nginx’s webserver fighting each other for port 80,

There is no PiHole own web server. If you use our PiHole install script, PiHole is installed without web server stack, as we use our DietPi functionality to install user defined web server module. Could it be that you installed lighttpd? Did you execute any PiHole repair steps?

---

<div class="post-metadata">

### Author: ![urostor](https://dietpi.com/forum/user_avatar/dietpi.com/urostor/32/1891_2.png) [@urostor](https://dietpi.com/forum/u/urostor)
#### Post date: [4 March 2023 22:35 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/13 "2023-03-04T22:35:02Z")

</div>

Ok. I tried pihole repair but it did nothing.

After stopping nginx, then pihole, then starting nginx, then pihole, I know pihole is running as I can ping local domains.

But there is another twist. I can view pi.hole/admin when connected through wireguard (10.9.x.x) but not when connected via my router (192.168.3.x).

I can also view local domain-based if my IP is 10.9.x.x.

Here are the lines from the block of code responsible for blocking outside traffic:

```auto
allow 127.0.0.0/8;
        allow 192.168.0.0/16;
        allow 10.0.0.0/8;
        allow 172.16.0.0/12;
        allow ::1/128;
        allow fe80::/10;
        allow fc00::/7;
        deny all;

```

EDIT: ok, fixed this with selecting “Permit all origins” in pihole, which somehow got reset when reinstalling.

But the primary thing still exists: nextcloud access from the Internet stopped working for some reason, as well as the nginx homepage. I will check my port forwards on routers, but I don’t think they changed.

EDIT2: now it works but I did not do absolutely anything. I am at a loss. The only thing I needed to do again is install the letsencrypt certificate.

EDIT3: I suppose the culprit is navidrome, apparently everything stopped working around 8:41 AM (it’s 0:32 AM next day now). I’ll check detailed logs, but it was then that everything became “unavailable” for home assistant…

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [5 March 2023 09:29 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/14 "2023-03-05T09:29:26Z")

</div>

Indeed, strange behavior. You can check status of running services as follow

```auto
dietpi-services status

```

As well check kernel logs and /or system logs

```auto
dmesg -l 0,1,2,3
journalctl

```

Just to avoid a misunderstanding on PiHole functionality.

PiHole DNS resolution and PiHole web interface are two different thinks. Both are independent features and can work without the other.

---

<div class="post-metadata">

### Author: ![urostor](https://dietpi.com/forum/user_avatar/dietpi.com/urostor/32/1891_2.png) [@urostor](https://dietpi.com/forum/u/urostor)
#### Post date: [5 March 2023 10:33 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/15 "2023-03-05T10:33:21Z")

</div>

Yup, I used `dmesg` and `journalctl` extensively, but there was nothing pointing to an issue there. I made a mistake of rebooting the pi before looking at them more carefully though.

When this was happening, all the relevant services were running (active). I am just curious why `nginx` would not start because “address was already in use” - I did not have any other running services which I read could interfere (apache, lighttpd).

Anyway, the first command only shows 1 thing right now:  
`bcm2708_fb soc:fb: Unable to determine number of FBs. Disabling driver.`  
Same as here. [Weird reboot behaviour on RPi 4 B - #2 by Joulinar](https://dietpi.com/forum/t/weird-reboot-behaviour-on-rpi-4-b/6277/2)  
Doesn’t seem relevant as it’s a headless server.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [5 March 2023 11:06 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/16 "2023-03-05T11:06:44Z")

</div>

> [@urostor](#):
>
> address was already in use

if this happens again, you can use following command to check ports in use

```auto
ss -tulpn | grep LISTEN

```

---

<div class="post-metadata">

### Author: ![urostor](https://dietpi.com/forum/user_avatar/dietpi.com/urostor/32/1891_2.png) [@urostor](https://dietpi.com/forum/u/urostor)
#### Post date: [5 March 2023 12:04 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/17 "2023-03-05T12:04:39Z")

</div>

Will do, thank you!

One more thing: any idea why the sites-dietpi configs were not deployed after uninstalling and reinstalling?

The sequence of what I did was:

```auto
dietpi-software reinstall 85 93
dietpi-software reinstall 85
dietpi-software uninstall 85
dietpi-software install 85
dietpi-software reinstall 89

```

With other commands in between (but I never removed anything from the folder `/etc/nginx/sites-dietpi`.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [5 March 2023 21:02 UTC](https://dietpi.com/forum/t/pi-hole-install-crashes-nginx/15960/18 "2023-03-05T21:02:15Z")

</div>

> [@urostor](#):
>
> but I never removed anything from the folder `/etc/nginx/sites-dietpi`.

The folder is removed on uninstall. And this you did 😉

PiHole web server configuration is pulled on install/reinstall only. It is not done on install of Nginx, because we don’t pull all kind of configs. This is triggered by the dedicated app only.
