Introduction
A LEMP stack is a group of open-source software that works together to serve dynamic websites and applications. The name LEMP stands for:
- Linux – the operating system
- Nginx (pronounced “Engine-X”) – the web server
- MySQL – the relational database management system
- PHP – the scripting language for dynamic content
Unlike the traditional LAMP stack that uses Apache, the LEMP stack replaces Apache with Nginx, a high-performance web server known for handling more concurrent connections while using fewer system resources. This makes it a popular choice for modern applications and high-traffic websites.
In this guide, you will learn how to install and configure the LEMP stack on Debian 12 (Bookworm)
Step 1 – Install Nginx
Nginx is a lightweight, high-performance web server that also works as a reverse proxy and load balancer. It is included in the default Debian 12 repositories, so installation is straightforward.
1. Install Nginx web server.
apt install nginx -y
2. Once installed, check the installed version.
nginx -v
Output.
nginx version: nginx/1.22.1
3. Enable Nginx to start automatically on system boot and start the service immediately.
systemctl enable nginx systemctl start nginx
4. Check the Nginx service status.
systemctl status nginx
Output.
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: active (running) since Fri 2025-09-05 12:40:50 UTC; 14s ago
Docs: man:nginx(8)
Process: 1067 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 1068 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 1092 (nginx)
Tasks: 3 (limit: 4642)
Memory: 2.4M
CPU: 28ms
CGroup: /system.slice/nginx.service
├─1092 "nginx: master process /usr/sbin/nginx -g daemon on; master_process on;"
├─1095 "nginx: worker process"
└─1096 "nginx: worker process"