I’m trying to set up local DNS using Pi-hole.

I have successfully set up Pi-hole and added a local DNS record local.com, pointing it to the server running the Pi-hole container 192.168.0.101.

Then I set up the Audiobookshelf container using the guide from Audiobookshelf, where I set up Nginx Proxy Manager with the following compose file:

services:
  nginx-proxy-manager:
    image: docker.io/jc21/nginx-proxy-manager:latest
    container_name: nginx-proxy-manager
    ports:
      - 80:80
      - 443:443
      - 81:81
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    restart: unless-stopped

And Audiobookshelf with the following compose file:

services:
  audiobookshelf:
    image: ghcr.io/advplyr/audiobookshelf:latest
    container_name: audiobookshelf
    volumes:
      - ./audiobooks:/audiobooks
      - ./podcasts:/podcasts
      - ./metadata:/metadata
      - ./config:/config
    restart: unless-stopped
networks:
  nginx:
    name: nginx-proxy-manager_default
    external: true

I did not specify a port, hoping that Nginx could manage it.

Then I set up Nginx Proxy Manager following the guide from Audiobookshelf by adding a proxy host. Trying to resolve audiobookshelf.local.com to I simply followed the guide and wasn’t sure why the “Forward Hostname / IP” should be the container name audiobookshelf.

I also created a self-signed certificate.

But I cannot access https://audiobookshelf.local.com/ or http://audiobookshelf.local.com/ (it automatically forwards to HTTPS).


I tried adding a local DNS record:
audiobookshelf.local.com192.168.0.101 in Pi-hole.
Now, when I access audiobookshelf.local.com, the site shows:
502 Bad Gateway – openresty


I think the problem lies in the Docker network setup. I suspect the Audiobookshelf Docker container is not communicating with Nginx.


Would appreciate any help!

    • Holeheadou92984@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      19 days ago

      I have turned it off and tried again, this time it allows me to go to http://audiobookshelf.local.com/, however still giving me the 502 Bad Gateway error.

      Anyway, it’s going to be used only locally, correct?

      yes that’s correct. But I still want to use self signed certificate just for extra security and get to know how to successfully configure it.

      • SaltySalamander@fedia.io
        link
        fedilink
        arrow-up
        0
        arrow-down
        1
        ·
        18 days ago

        But I still want to use self signed certificate just for extra security and get to know how to successfully configure it.

        Then buy a real domain name and do it properly.

  • Brkdncr@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    19 days ago

    I don’t see an immediate issue but I do see some general issues.

    Unless you own local.com, don’t use it.

    While you could use .local as your tld, I wouldn’t do that either. You can buy a domain name for cheap and really that’s the way to go.

    Also, reference your FQDN and not your hostname. Don’t expect hosts to fill in the blanks.

    • tburkhol@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      18 days ago

      Second not using local.com If OP doesn’t want a real domain, use an unresolvable TLD, like “private” (so, pihole.private, audiobookshelf.private), but a real domain will just work better, will let them use real TLS certs, and prevent problems from apps bypassing system DNS. Even if it’s not as pretty or memorable as the hijacked domain name.

  • Miggi@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    1
    ·
    18 days ago

    Both your containers need share at least one network. It looks like have created a external network. Good job. The next step is to configure your container to join the network. Do something like this:

    services:
      nginx-proxy-manager: 
         ....
         networks:
           - nginx-proxy-manager_default # or just nginx
          ...
    
    networks:
      nginx:
        name: nginx-proxy-manager_default
        external: true  
    

    Don’t forget to also add the network in your audiobookshelf service.

    Maybe this helps: https://docs.docker.com/compose/how-tos/networking/#use-an-existing-network

  • Malasaur@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    1
    ·
    19 days ago

    I’m pretty sure you have to specify a different port. Audiobookshelf uses port 80 by default - which is already taken by NPM - and since you’re not mapping it to any other port those services will conflict.

    Map the port to something easy to remember in the compose file. Not only is it required in your setup but it is good practice. If you have to manage a lot of services, it is hard to keep track of all the ports they use if you keep them on their default values. I personally chose a port range (like 12300 -> 12399) and map all of my services respectively (Komodo to 12300, Authentik to 12301, etc.).

    Also remember to update the port in your NPM config.

    TL;DR: Audiobookshelf’s default port is 80, which conflicts with NPM. Change it.

    • calm.like.a.bomb@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      1
      ·
      18 days ago

      There’s no conflict regarding ports. Each container can have the same ports open. You’re thinking about the host network here, but it’s not the case.

    • Holeheadou92984@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      19 days ago

      thank you!

      I have added

          ports:
            - 13378:80
      

      in audiobookshelf docker compose and changed npm settings

      But it still gives me the same 502 Bad Gateway error.

      • Malasaur@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        0
        ·
        18 days ago

        I’ve just noticed: you’ve set your forward hostname/IP to audiobookshelf. That should either be your PC’s IP address (if you’ve set up a static one in your router’s panel) or its hostname. Unless you’ve named your PC audiobookshelf it still won’t work.