I am just starting out on the web and trying to understand a complete web stack, where the different pieces of it live and how they interact. I know there are infinite opinions but want to make sure my general understanding of the stack is correct.
My current understanding:
Client-side - Usually a combination of CSS, HTML, and JS. JS can be used in a framework like Angular, Vue, Backbone or React. These send a request to a web server.
Web-Server - This handles request from client computers. Popular web servers include Apache and Nginx. A web server can be run either locally (for testing), on a physical server or on the cloud (ex AWS EC2). These web-servers are configured using a server side language
Server-side Language - These are used to create the logic of the website. We program the web-server using a variety of languages (with popular frameworks in parenthesis): Ruby (Ruby on rails), Python (django, flask, pylons) and PHP (Laravel). Whenever these need to fetch data, they connect to a Database.
Database - A place to store a sites data. These can either be run on another local server running MySql and Postgresql or through the cloud like DynamoDB or MongoDB. Sometimes these databases can be too slow so we use another caching DB
Caching DB - A web application needs a caching system to reduce the load on the DB and to handle large amounts of traffic. We run another server, either on our servers or through the cloud like Amazon ElastiCache for Redis or self managed Redis on EC2. Sometimes we need to store large files.
Storage - When we need to store large files, instead of key-value pairs like in DB, we need a data store. This is good for photos and videos for example. We can either do this through a separate server or through the cloud (ex. S3)
NodeJS - After reading this post NodeJS can replace 2 pieces of this. It both serves as a server (replacing apache, nginx) and a backend language (replacing php, python, ruby on rails). Some people still use an apache server in front of the node server to reduce risk but this is becoming less and less necessary because NodeJS server is now pretty robust.
Extras - We can put Elastic Node balancers in front of our web server if we have more than 1 and want to help balance the request. CDN are a set of proxy servers geographically separated that cache some of the content. This reduces the load on our main server while giving higher performance.
So to summarize: client -> server (programmed by a backend language) -> A variety of different DBs, main (ex MySql), Cached (Redis) and Storage (S3).
What is wrong with my understanding of the stack? Also, reading this post, it sounds like Ruby on Rails is a web-server, just like apache, which seems to contradict my thoughts above. What am I missing here around server-side languages and web servers?