Apologies in advance for being a total newbie with all things infrastructure related.
A little background: I'm developing a server app for an Android application. The app will communicate with the backend using its domain name (for instance, JSON POST example.com/doSomething). The server code is currently running behind nginx on one machine and everything works fine.
I only have 1 external IP address (which is where example.com is directed to).
However, I have 2 Linux servers at my disposal which I would like to use to host the server. They will host identical binaries and have access to the same database, etc. and will behave identically in all respects. I would like to use both servers so that I can have (1) redundancy and (2) performance optimization (round robin) if possible instead of the current setup which is 1 server behind my domain.
The question is: Is it possible to somehow configure nginx (or anything else really, even the DNS server) so that requests to example.com automatically are redirected to one of the two servers, whilst maintaining a round robin structure, so that both servers serve the same number of requests and if one server goes down, the requests still get sent to the second server?
If it's possible, how would I go about it and if not, do you know of any other way to make use of both servers?
Many thanks in advance,