It's possible to have multiple physical servers behind one home router?

I have multiple Raspberry Pi at home and I would like to use them as web servers for some of my projects. I'm aware that I could host several sites on one Pi with virtual hosts, but I want just one on each, so they have more resources available and there are more independent.

I' also aware that I could use different ports for each one,but I would like to use port 80 for all of them, so there are accessible to anyone that type the domain.

So the question is, how can I have two or more domains pointing to the same IP address and make the router (or one of the RPi) figure out which website is hosted in which Pi?

Is it possible at all?


Solution 1:

Yes it is possible. Your easiest way is probably to setup a reverse proxy. You would then point all your URLs to the reverse proxy server that would retrieve the URL endpoint and point back to the appropriate server.

Here is the Wikipedia article on them: https://en.wikipedia.org/wiki/Reverse_proxy

A good open source (free) reverse proxy is: https://www.nginx.com/products/feature-matrix/