Chapter 12: Technology Stacks — LAMP, LEMP, MEAN, MERN
Interview Questions
These stack questions surely come up in interviews. Along with the acronym, explain the request flow and ports.
स्टॅक्सवर हे प्रश्न इंटरव्ह्यूमध्ये नक्की येतात. ॲक्रोनिमसोबत रिक्वेस्ट फ्लो आणि पोर्ट्स बोलून दाखवा.
स्टैक्स पर ये सवाल इंटरव्यू में ज़रूर आते हैं. एक्रोनिम के साथ रिक्वेस्ट फ़्लो और पोर्ट्स बोलकर बताओ.
- Q1. Expand LAMP, LEMP, MEAN and MERN.
- LAMP: Linux, Apache, MySQL, PHP. LEMP: Linux, Nginx, MySQL, PHP. MEAN: MongoDB, Express, Angular, Node.js. MERN: MongoDB, Express, React, Node.js.
- Q2. What is the difference between LAMP and LEMP?
- LEMP replaces Apache with Nginx; PHP then runs in PHP-FPM, connected via FastCGI, instead of Apache's
mod_php. - Q3. How is a React app deployed to production?
- Run
npm run buildto produce static files, copy them to a web root, serve with Nginx usingtry_files ... /index.html, and proxy/apito the backend. - Q4. Why is MongoDB bound to 127.0.0.1 by default?
- To prevent remote access; exposing it without authentication has led to many data breaches.
- Q5. What is the role of Express in MERN?
- Express is the Node.js web framework that implements the REST API — routing, request parsing and database access through a driver like Mongoose.
- Q6. SQL vs NoSQL — when would you choose MongoDB?
- MongoDB (document store) suits flexible or evolving schemas and JSON-like data; relational databases suit structured data with strong relationships and transactions.
More stack questions
Q. What would you choose for a bank's internal app?
Often Spring Boot or ASP.NET Core with PostgreSQL, SQL Server or Oracle, because of mature tooling and enterprise support. Say that the team's skills decide as well.
Q. Why is React served by nginx but Express is proxied?
React builds to static files (HTML, JS, CSS), which nginx serves directly. Express is a running program, so nginx forwards requests to it.
Q. Where do sessions go when you scale out?
A shared store such as Redis, so any app server can handle any request.
Q. What is the role of PM2, systemd and Gunicorn?
They keep app processes running, restart them on crash and start them at boot. PM2 is for Node.js, Gunicorn for Python. systemd can manage any of them.
Q. How do you host this on Azure or GCP?
Azure App Service or Google App Engine / Cloud Run for the app, Azure Database or Cloud SQL for the database. The same three-tier idea applies.
Q. Why build React with npm run build instead of npm start?
The build makes optimised static files. npm start runs a development server that is not meant for production.
Q. What does try_files $uri $uri/ /index.html do?
It serves a file if it exists, and otherwise returns index.html so the single-page app's router can handle the URL.
Q. How do you secure MongoDB?
Turn on authentication, bind to a private address, give least-privilege users and take backups.
Scenario (common at service companies like Infosys): "The client wants to move a MERN app from one EC2 to AWS managed services." Answer: React to S3 + CloudFront, Express to ECS or Elastic Beanstalk behind an ALB, MongoDB to Atlas or a compatible managed service, and secrets to Secrets Manager.
Key terms
- Stack: A set of technologies used together.
- SPA: Single-page app (React, Angular), built to static files.
- REST API: An HTTP interface returning JSON.
- try_files: The nginx rule that lets SPA routes work on refresh.
- bindIp: The MongoDB setting for which addresses it listens on.
- ODM / ORM: Libraries that map objects to documents or tables, such as Mongoose, Hibernate, EF Core and Django ORM.
Mini case study
Suppose we are a junior cloud engineer at a Bengaluru e-commerce startup (sample data). The team runs a PHP admin, a Node.js storefront API and a Python report job on two EC2 instances. Using this chapter, you write a one-page runbook: which service listens where, how to test and reload each one, which logs to read, and which ports are public (only 80 and 443, plus 22 from the office IP). New team members can then fix most problems on their own.
Quick revision cards
Revise this lesson in two minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens its lesson.

More cards: Ravi Sir's Cards.