"Web Development to Deployment and Operations (7/8) — Frontend and backend deployment architecture: EC2, app servers, and nginx"
Deployment is not just buying a server. It is designing how requests travel through boundaries until they reach the code that should handle them.
Key Takeaways
- EC2 is a virtual server environment, while nginx is commonly the web-facing layer that serves files and proxies requests to application processes.
- A common request path is
domain -> nginx -> application server -> database or external services. - In deployment, the frontend/backend distinction becomes clearer when framed as execution responsibility, not only as file type.
- A single EC2 machine can host multiple layers, but understanding their separation is what makes scaling and debugging possible later.
1. Why EC2 appears so often in deployment discussions
Amazon EC2 is one of the classic entry points for learning server-based deployment. The official AWS docs describe it as a way to launch and manage virtual server instances.
For beginners, the easiest mental model is this: EC2 gives more direct control, which also means more direct responsibility.
That responsibility includes decisions such as:
- which operating system to use
- which ports to open
- which processes should keep running
- how restarts, updates, and logs should be handled
Managed platforms hide much of this. EC2 makes the layers more visible, which is exactly why it is useful for learning.
2. How web servers and application servers differ
The terms WS and WAS can sound old-fashioned, but the role separation still matters.
Web server
A web server such as nginx is strong at handling static files, receiving public traffic, and deciding where requests should go next. It commonly handles reverse proxying, compression, and routing.
Application server
The application server runs the actual business logic. That might be a Node.js process, a Python server, or another runtime that receives requests and produces responses.
So the clean distinction is this: the web server manages the front door and traffic direction, while the application server performs the real application work.
3. Why put nginx in front
Beginners often ask a reasonable question: why not expose the application port directly?
That can work for a small experiment, but production architecture usually benefits from a front proxy layer.
Static asset delivery
CSS, JavaScript, images, and other static files can often be served more efficiently without pushing every request through the application runtime.
Reverse proxy boundaries
Public traffic can come in through ports 80 and 443, while internal application processes stay on ports such as 3000 or 8000. That keeps public exposure and internal execution better separated.
Request routing
Different paths can go to different destinations. For example, /api may go to a backend service, while other traffic goes to a frontend app or static output.
Operational isolation
Application processes may restart independently while the proxy layer continues to define the stable traffic boundary.
The nginx beginner documentation is useful here because it shows that nginx is not only a file server. It is also a controllable traffic-management layer.
4. Where frontend and backend meet in deployment
A simplified architecture often looks like this:
browser
-> domain
-> nginx
-> frontend static assets or SSR server
-> backend API server
-> database or external services
The important point is that frontend deployment is not always only file hosting. If the frontend uses server-side rendering, it may also require its own runtime process.
That makes the deployment view more precise:
- frontend: user-facing assets and UI execution layer
- backend: business logic, auth, data access, and policy layer
- nginx: public entrypoint and request-routing layer
This framing is much more useful operationally than thinking only in terms of "screen code" versus "server code."
5. What to watch when everything lives on one server
It is common for a beginner project to place nginx, frontend, and backend on one EC2 machine. That is a reasonable learning setup, but it has limits.
Resource contention
Builds, API traffic, log writing, and application rendering may compete for the same CPU and memory.
Shared failure domain
One misconfigured deploy or one unhealthy process can affect the entire service.
Operational complexity
Even on one machine, ports, firewall rules, process management, log locations, and deployment scripts all need clear ownership.
So the lesson is not "one-server deployment is wrong." The lesson is that even one-server deployment already contains multiple architectural layers.
6. A minimum structure worth remembering
For beginners, three lines are enough to hold the picture together:
- EC2 is the execution environment.
- nginx is the public-facing traffic gate.
- The application server is the process that runs the product logic.
If these roles stay separate in your mind, later topics such as Docker, load balancers, auto scaling, and orchestration become much easier to place.
References
- AWS Docs, Get started with Amazon EC2 — https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html
- NGINX Docs, Beginner's Guide — https://nginx.org/en/docs/beginners_guide.html
- Next.js Docs, Deploying — https://nextjs.org/docs/pages/building-your-application/deploying
This is Part 7 of the Web Development to Deployment and Operations series.
Series overview: Series index
๋๊ธ
๋๊ธ ์ฐ๊ธฐ