The LEMP stack is a web platform made of Linux, Nginx (pronounced "engine x", hence the E), MySQL or MariaDB, and PHP. It is the Nginx-based counterpart to the LAMP stack and is common on VPS and cloud servers.
Why it matters
Nginx does not run PHP inside its own process. It passes PHP requests to a separate PHP-FPM service, which manages a pool of workers. This separation gives good control over resources and performance under high concurrency, but it also introduces a typical failure point: if PHP-FPM is stopped, overloaded or listening on a different socket than Nginx expects, visitors get 502 or 504 errors.
Example
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
If the socket path or PHP version in fastcgi_pass does not match what is installed, Nginx cannot reach PHP and returns 502.
Common mistakes
- Copying a config that names a different PHP-FPM version or socket.
- Forgetting that
.htaccessfiles are ignored, so Apache-style rewrite rules must be converted. - Setting
max_childrentoo low or too high for available memory.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.