Comment on ELI5: How to put several servers on one external IP?
tofu@lemmy.nocturnal.garden 2 days ago
You need a reserve proxy. That’s a piece of software that takes the requests and puts them toward the correct endpoint.
You need to create port forwards in the router and direct 80 and 443 (or whatever you’re using) toward the host of the reverse proxy and that is listening to on those ports. If it recognized the requests are for nas.your.domain, it will forward the requests to the NAS.
Common reverse proxies are nginx or caddy. You can install it on your raspberry, it doesn’t need it’s own device.
If you don’t want that, you can create different port forwards on your router (e.g. 8080 and 8443 to the Raspi) and configure your service on the Raspi corresponding. But it doesn’t scale well and you’d need to call everything with the port and the reverse proxy is the usual solution.
Allero@lemmy.today 2 days ago
There’s an issue with that first part. Do I configure it right? Should <domain>:8100 be redirected to 192.168.0.113:81 in this case?
Image
infeeeee@lemmy.zip 2 days ago
External 80 to internal 80 and external 443 to internal 443
With this config you don’t have to deal with ports later, as http is 80, https is 443 by default.
If you run some container on port 81, you have to deal with that in the reverse proxy, not in the router. E.g. redirect something.domian.tld to 192.168.0.103:81
If you use docker check out nginxproxymanager, it has a very beginner friendly admin webui. You shouldn’t forward the admin ui’s port, you need to access it only from your lan.
Allero@lemmy.today 2 days ago
Actually, I do and you guessed it by the port correctly. I just tried to expose it as a testing example.
And since we’re talking about this, what do I do with it next? I have it on my Pi, how do I ensure traffic is distributed through it as a reverse proxy? Do I need to expose ports 80 and 443 and then it would work automagically all by itself?
infeeeee@lemmy.zip 2 days ago
You type the ip of the rpi on the router, so from an external call the router will forward it to the rpi. Or I don’t know what is your question.
Things may seem automagical in the networking scene, but you can config anything the way you want. Even in nginxproxymanager you can edit the underlying actual nginx configs with their full power. The automagic is just the default setting.