ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    PiHole - Nginx Reverse Proxy

    IT Discussion
    5
    16
    6.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBuschJ
      JaredBusch @Alex Sage
      last edited by

      @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

      1 Reply Last reply Reply Quote 1
      • JaredBuschJ
        JaredBusch
        last edited by

        @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; }
        }
        
        1 Reply Last reply Reply Quote 3
        • A
          Alex Sage
          last edited by

          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;
                  }
          }
          
          coliverC 1 Reply Last reply Reply Quote 1
          • coliverC
            coliver @Alex Sage
            last edited by

            @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?

            A 1 Reply Last reply Reply Quote 0
            • A
              Alex Sage @coliver
              last edited by

              @coliver I am, this is for a new install before I setup TLS 😉

              1 Reply Last reply Reply Quote 0
              • A
                Alex Sage
                last edited by Alex Sage

                Sadly, this doesn't seem to work with TLS enabled. I'll have to figure out why.

                0_1541701758525_839dcf66-6190-4440-afe9-2c0507d6db9c-image.png

                travisdh1T 2 Replies Last reply Reply Quote 0
                • travisdh1T
                  travisdh1 @Alex Sage
                  last edited by

                  @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.

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    Alex Sage @travisdh1
                    last edited by

                    @travisdh1 Thanks! Greatly appreciate it. I added a screenshot to my post above.

                    travisdh1T 1 Reply Last reply Reply Quote 0
                    • travisdh1T
                      travisdh1 @Alex Sage
                      last edited by

                      @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.

                      1 Reply Last reply Reply Quote 0
                      • travisdh1T
                        travisdh1 @Alex Sage
                        last edited by

                        @aaronstuder said in PiHole - Nginx Reverse Proxy:

                        Sadly, this doesn't seem to work with TLS enabled. I'll have to figure out why.

                        0_1541701758525_839dcf66-6190-4440-afe9-2c0507d6db9c-image.png

                        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?

                        A 1 Reply Last reply Reply Quote 0
                        • A
                          Alex Sage @travisdh1
                          last edited by

                          @travisdh1 Interesting, so it is working.

                          That's correct the pointed to /admin

                          1 Reply Last reply Reply Quote 1
                          • 1 / 1
                          • First post
                            Last post