I have owned a VPS running Ubuntu for nearly half a decade, and I have a working knowledge of the networking aspect - but there are many holes in my understanding.
When I visit DOMAIN:PORT I understand that the request is routed to the IP in my A-record specified in my nameservers, and consequently reaches my VPS - but I don't completely understand what happens after that:
- How does nginx then receive the request? Is there some hardware level functionality that routes it to the configured web server?
- If I have multiple webservers running, say nginx and apache - what decides what takes precedence?
- Does nginx then intercept all incoming requests? Say I have ufw allowing 8000 - then is that DOMAIN:8000 request routed through nginx? Or can it hit some other say node server running locally on that port?
These are questions I have puzzled over without being able to figure out what to google for.
Any pointers in the right direction will be much appreciated.
P.S. Mods, I looked at the suggested related questions and I feel like none address my specific set of questions. Feel free to correct me in the comments, if I'm wrong.