PiHole - Nginx Reverse Proxy
-
@aaronstuder said in PiHole - Nginx Reverse Proxy:
Anyone got it working?
I found a couple of way to do it, but none of them worked
WTF are you trying to do? Your web interface?
Just forward it like any other server.
Does something not work as you are expecting/ -
@jaredbusch It loads from a directory /admin, so I can't get that to forward
-
Its been awhile but I remember that the web interface didn't load correctly.
-
-
@aaronstuder said in PiHole - Nginx Reverse Proxy:
@jaredbusch It loads from a directory /admin, so I can't get that to forward
Your should have a location entry for
/admin
that contains the proxy pass.And the location entry for
/
should be a rewrite to/admin
-
@aaronstuder example:
server { client_max_body_size 40M; listen 443 ssl; server_name oc.domain.com; ssl on; ssl_certificate /etc/letsencrypt/live/oc.domain.com-0001/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/oc.domain.com-0001/privkey.pem; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_redirect off; location = / { rewrite ^ /owncloud$args last; } location ~* ^/owncloud { proxy_pass https://10.202.1.17; } }
-
Here is my working .conf file:
server { client_max_body_size 40M; listen 80; server_name pihole.domain.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://10.0.0.X:80/admin/; proxy_redirect off; } }
-
@aaronstuder said in PiHole - Nginx Reverse Proxy:
Here is my working .conf file:
server { client_max_body_size 40M; listen 80; server_name pihole.domain.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://10.0.0.X:80/admin/; proxy_redirect off; } }
Are you not doing SSL?
-
@coliver I am, this is for a new install before I setup TLS
-
Sadly, this doesn't seem to work with TLS enabled. I'll have to figure out why.
-
@aaronstuder said in PiHole - Nginx Reverse Proxy:
Sadly, this doesn't seem to work with TLS enabled. I'll have to figure out why.
The last time I looked at the one on my home lab it was working. It does tend to get broken on updates often tho. I'll try to remember to post my nginx config for you tonight.
-
@travisdh1 Thanks! Greatly appreciate it. I added a screenshot to my post above.
-
@aaronstuder said in PiHole - Nginx Reverse Proxy:
@travisdh1 Thanks! Greatly appreciate it. I added a screenshot to my post above.
That's exactly what I've seen when mine breaks. Now you've got me worried that mine will be broken when I go look.
-
@aaronstuder said in PiHole - Nginx Reverse Proxy:
Sadly, this doesn't seem to work with TLS enabled. I'll have to figure out why.
Going to pihole.lxd1.net for me shows the interface correctly, it's adding the /admin to the url that messes it up. I'm guessing that the reverse proxy is set to hit pihole.lxd1.net/admin automatically?
-
@travisdh1 Interesting, so it is working.
That's correct the pointed to /admin