But now, I would love to understand what is behind the scenes and why I had this struggle with hypercorn (I have no idea what this software does)...
So, if anyone can tell me how the traffic goes around these settings and also taking into account this hypercorn thing, I would love to hear about it!
Because I can't use port 5000 and I'm not sure I understand why. I mean, I think I know why, but I don't understand it. I think I can't use port 5000 because I have it in nginx config file for the reverse proxy directive
proxy_pass https://localhost:5000.
In simple terms the traffic *should* goes around like this:
Internet <> Router <> Nginx <> Hypercorn <> LNBits
The reason why it got problems was that:
1. You are using port 5000 as a virtual server(Listening port) while port 5000 are already being used by Hypercorn(LNBits). Just like what @DaveF mention above
As you've guessed. The reverse proxy directive is 5000 which it's the port brought up by Hypercorn(LNBits). So Nginx cant use port 5000, again.
2. Your initial router firewall configuration is bypassing Nginx, so, it directly connects into Hypercorn(LNBits)
The
dest_port should be pointed into the Nginx listen port, so it will be able to acknowledge the SSL setting. Since initially, you are using the 5000 port, either you are accessing from a local network or from the domain, it would always communicate to the HTTP site of LNBits. Using the above scheme, the traffic flow is like: Internet <> Router <> Hypercorn <> LNBits.
To sum up, you are accessing LNBits, either from the domain or local
[Internet], then your router firewall rule is port forwarding
:5001 into 192.168.151:5001(src port, dest_ip:dest_port)[Router]. After that, the Nginx acknowledged what to do since the referred port are 5001, the one you set up, listen 5001 ssl...[Nginx]. And then it passed to Hypercorn and lastly LNBits.