Can't access Pihole inside local network

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
Jonesyj83
Posts: 3
Joined: Thu Mar 04, 2021 1:59 am

Can't access Pihole inside local network

Post by Jonesyj83 »

So have latest dietpi installed with nginx running nextcloud and pihole. I can access nextcloud and pihole from my domain name outside of my network. But when I enter the LAN ip of my dietpi server all I get is a 404 error. Have looked through all the conf files in /etc/nginx and can't see any problems

Any tips on what I can check?

Cheers
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: Can't access Pihole inside local network

Post by Joulinar »

what is the URL you are using to access PiHole locally?
What is the URL for NexctCloud?
What URL you are using to access from external?
Did you do any manuell configuration on Nginx configuration files?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Jonesyj83
Posts: 3
Joined: Thu Mar 04, 2021 1:59 am

Re: Can't access Pihole inside local network

Post by Jonesyj83 »

i'm using http://192.168.1.10/admin and 192.168.1.10/nextcloud, both don't work locally
but I can use https://mydomain.com/admin and /nextcloud and both work fine.

all config files are standard since setup. Set Nginx as standard web server, installed pihole then nextcloud. Then done dietpi-letsencrypt.
Jonesyj83
Posts: 3
Joined: Thu Mar 04, 2021 1:59 am

Re: Can't access Pihole inside local network

Post by Jonesyj83 »

After looking again in default conf file. I found Certbot added a few lines blocking local access. Have now fixed it.
User avatar
Joulinar
Posts: 4249
Joined: Sat Nov 16, 2019 12:49 am

Re: Can't access Pihole inside local network

Post by Joulinar »

ok it seems to be an issue of certbot adding some code not really working on local network if you use IP address. Found a working solution to force http into https independent of the url/ip you are using

I replaced the whole section (old one hashed) defining the http server

Code: Select all

server {
  listen 80;
  server_name _;
  rewrite ^ https://$host$request_uri? permanent;
}

#server {
#    if ($host = mnietsch.ddnss.de) {
#        return 301 https://$host$request_uri;
#    } # managed by Certbot
#
#
#
#       listen 80 default_server;
#       listen [::]:80 default_server;
#
#       server_name mnietsch.ddnss.de;
#    return 404; # managed by Certbot
#
#
#}
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply