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.com
→ 192.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!
If the port isn't being explicitly exposed then it won't expose by default. I have my containers set up in a similar way where nginx has it's own network and I attach any containers I want to proxy to the same network. On most cases I'm able to remove the ports section from config and point nginx at the name of the container, and the container's default http port. The way OP originally configured this should be fine IF nginx and audiobookshelf are on the same docker network.
I honestly didn't know that. I personally just configure a specific port for each stack and have NPM forward it directly without configuring any network.
I just noticed OP did configure a network, but tbh I don't know how they work exactly and gave recommendations on what I knew.
If using networks is the standard way or OP feels better off that way then I'll leave them to it