Hi all,

I've been brainstorming on a virtual hosting setup that could get by with only two public IP-addresses. This is mostly because the world still isn't ready for IPv6 and IPv4 addresses have basically ran out and additional IP's can (eventually) get expensive.

Let's say we assign IP 123.123.123.1 to physical server and 123.123.123.2 to first virtual server running NGINX proxy, DNS and anything else that must be reachable from the internet. The virtual server also receives local IP-addrss of 10.10.10.1.

Next we set up the second virtual machine, one that serves up both static and dynamic content in webpages. Since we have no public IP-addresses left, we can only give it local IP-address of 10.10.10.2. Let's say this virtual server hosts a domain called domain1.com.

And finally, let's set up identical virtual server with local IP-address of 10.10.10.3 and that serves domain2.com.

And now to business. How to make these virtual servers to work without public IP-addresses? Right now I don't really have the means to test any of this in practice unfortunately, so right now I'm limited to brainstorming and which is why I humbly ask for you input and assistance.

As mentioned early in the post, the first virtual server that has a public IP-address is running NGINX. I was thinking it could redirect http requests based on requested hostname to right virtual server. But there comes the problem I could not find definite answer by googling. Is redirection to local IP-addresses supported or does the address have to be public?

And even if NGINX is able to redirect requests to local IP-address, can clients communicate with web servers properly if these don't have public IP-address? I think it should be somehow possible to set them to report 123.123.123.2 as their IP-address so that returning packets are again proxied by NGINX to right virtual server.

Is this kind of setup doable? Do you fine folks have any input how you would make it work and what kind of configuration would you use?

Of course, http requests are just the first hurdle, next we'd need to figure out how to proxy ftp, ssh and any other protocols based on requested domain. Perhaps we can even use something else than NGINX to serve as a proxy for all protocols?

Hopefully we'll have a good discussion. If you know of any articles or other resources on this subject, please do give a link!