The LEMP stack — Linux, Nginx, MySQL, and PHP — powers dynamic web applications with Nginx's high-concurrency architecture at the front and PHP-FPM's FastCGI process pool handling PHP execution. Ubuntu 26.04 ships with PHP 8.5, giving you a modern base to build on. This guide sets up a production-ready LEMP stack, secures it with a Let's Encrypt certificate, and verifies the full setup with a PHP page that reads from MySQL. By the end, you'll have a fully operational LEMP server ready to host web applications.
Install Nginx
1. Update the APT package index:
$ sudo apt update
Enter fullscreen mode
Exit fullscreen mode
2. Install Nginx:
$ sudo apt install nginx -y
Enter fullscreen mode
Exit fullscreen mode
3. Enable and start the service:
$ sudo systemctl enable nginx $ sudo systemctl start nginx
Enter fullscreen mode
Exit fullscreen mode
Install MySQL
1. Install the MySQL server package:
$ sudo apt install mysql-server -y
Enter fullscreen mode
Exit fullscreen mode
2.…