Hello! I hope I’m at the right place. So basically, I have nginx installed on my RaspberryPi, working perfectly fine. It’s configured with Let’s Encrypt, enforcing https.
I cannot access the url:port at all. Even though I have the port enabled. Now I have been trying to google like mad for this on how “it” works when I have a “native” nginx installed and configured + now also wanting to run docker images with webUI’s. But every hit I get relates to issues with nginx VIA docker and other images.
I am fairly certain it’s a configuration thing but I do not know where to look.
Have anybody else have had issues like this while using docker images while at the same time running an nginx installation “natively” outside docker?
I’ll gladly post more information, configs etc. if needed
Hello! Local PC yes, however the same results if I use the local ip (192.168…) Public IP or the DNS name I have setup. Works fine for my nginx on port 80 and 443
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ab9a8e4d0b81 deluan/navidrome:latest "/app/navidrome" 7 minutes ago Up 7 minutes (healthy) 0.0.0.0:4533->4533/tcp, :::4533->4533/tcp navidrome-navidrome-1
netstat -tulpn
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:4533 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp6 0 0 :::4533 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 ::1:25 :::* LISTEN -
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 0.0.0.0:5353 0.0.0.0:* -
udp 0 0 0.0.0.0:10000 0.0.0.0:* -
udp 0 0 0.0.0.0:39366 0.0.0.0:* -
udp6 0 0 :::43153 :::* -
udp6 0 0 :::5353 :::* -
Yeah stupid of me to not include basic info like that, sorry I’m just exhausted but refuse to give up
The error was an ‘unable to connect’ unfortunately I don’t remember the error code, because I have another situation now.
curl returns the html data for my nginx server default index.html “welcome to nginx blah blah” (weird since i did curl localhost:4533 lol?
The routing is done via my router via Virtual Port / Port Forwarding. For the internet → RaspPi server access. However, I also have it “enable” as in allow traffic for 4533 via ufw that I use on the server.
BUT.
I did some testing. Which hopefully might help? So I tried:
I stopped nginx, ‘sudo systemctl stop nginx’ along with ‘docker compose down’
I launched the image again, docker compose up -d
Again tried to browse to the IP both the local 192.168…:4533 IP, and it… works? I now tried the public IP, works?!
So I thought, fair enough then, I’ll try to launch nginx back up. ‘sudo systemctl start nginx’ and received an error, so I checked journalctl -xe and saw this all of a sudden:
Jan 24 23:00:10 raspberrypi nginx[6826]: nginx: [emerg] bind() to 0.0.0.0:4533 failed (98: Address already in use)
Jan 24 23:00:11 raspberrypi nginx[6826]: nginx: [emerg] bind() to 0.0.0.0:4533 failed (98: Address already in use)
Jan 24 23:00:11 raspberrypi nginx[6826]: nginx: [emerg] bind() to 0.0.0.0:4533 failed (98: Address already in use)
Jan 24 23:00:12 raspberrypi nginx[6826]: nginx: [emerg] bind() to 0.0.0.0:4533 failed (98: Address already in use)
Jan 24 23:00:12 raspberrypi nginx[6826]: nginx: [emerg] bind() to 0.0.0.0:4533 failed (98: Address already in use)
Jan 24 23:00:14 raspberrypi nginx[6826]: nginx: [emerg] still could not bind()
Jan 24 23:00:14 raspberrypi systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
So naturally, I did the reverse thing… a) shut down the docker image, b) start nginx which now of course started fine. And now tried to start the docker image again and receive the following:
[+] Running 1/1
✔ Container navidrome-navidrome-1 Created 0.0s
Error response from daemon: driver failed programming external connectivity on endpoint navidrome-navidrome-1 (4c1f638dd97417d70c45c3f41def9cc519412b1c6b5b13fadc0e74f8d6944974): Error starting userland proxy: listen tcp4 0.0.0.0:4533: bind: address already in use
Conclusion that I can make out of this, is that yeah there is some conflict with ip being already binded. But I don’t know why.
This is the configuration for the sites-available in nginx. (omitted some stuff)
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl default_server;
listen 4533 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php default.php;
server_name dns.name.tld;
ssl_certificate thepath;
ssl_certificate_key thepath;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
#
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
From the sites-available config. And it now “works”. It seems like…
However I need to define HTTP IP : PORT to go to Navidrome. Will that aforementioned guides linked above help me with forcing it to also use HTTPS perhaps? So i can use HTTPS IP : PORT ?
Or is it something I have to sort out in my nginx config?
Well, you configured nginx to listen to port 4533 and your container to listen to 4533. It can’t be both, decide for one.
If you want a single point of entry through a proxy, I recommend nginx-proxy or Traefik (simple example) for automatic target discovery via env/labels.