I am trying to figure things out and I am confused. I know some things but not enough.
I know that domains actually point to the IP address of a server. So if I want to have two apps, they both have to point to the same server. For example:
domain1.com => 139.130.4.5
domain2.com => 139.130.4.5
And I would have to configure both of them to point to the same IP address? Right?
They both will default to port 80 right (139.130.4.5:80)? How does the server know which app to serve?
Lets say I have these two apps on Debian:
127.0.0.1:3000
127.0.0.1:4000
And NGINX accepting request on port 80 and somehow deciding which up to serve. How does it all work?
What I was thinking first, you would have to configure domains to point to:
domain1.com => 139.130.4.5:3000
domain2.com => 139.130.4.5:4000
But it doesn't work like that, if not like that, how? 🙂
Thanks!
Best Answer
It's called name based virtual hosts. Nginx would serve the site based upon the FQDN requested.