Ubuntu 24.04 with LEMP Stack

This comprehensive guide covers all steps to launch and verify your LEMP Stack (Linux, Nginx, MySQL, PHP) instance on Ubuntu Server 24.04.

Overview: This AMI provides a pre-configured Ubuntu 24.04 LTS environment with a complete LEMP Stack, ready for immediate web application development and deployment. The stack includes Linux (Ubuntu 24.04), Nginx web server, MySQL database, and PHP, offering a powerful, lightweight, and efficient platform for developing and deploying high-performance web applications.

Step 1: Launch EC2 Instance

  1. Navigate to the LEMP Stack on Ubuntu 24.04 AMI
  2. Click “Continue to Subscribe”
  3. Accept the terms and click “Continue to Configuration”
  4. Select your preferred AWS region
  5. Click “Continue to Launch”

Recommended Configuration

  • Instance Type: t3.medium or higher
  • Storage: Minimum 20 GiB (50 GiB recommended for production)
  • Security Group:
    • Port 22 (SSH)
    • Port 80 (HTTP)
    • Port 443 (HTTPS)
    • Port 3306 (MySQL) – Only if remote database access is needed

Step 2: Connect to Your Instance

Secure Shell (SSH)

  1. Wait for the instance to reach the running state in your cloud console
  2. Locate the instance’s Public IP address
  3. Use an SSH client (like Terminal on macOS/Linux, or PuTTY/Windows Terminal on Windows) and your private key file
  4. The default username for Ubuntu AMIs is typically ubuntu
Command: ssh -i /path/to/your-key-pair.pem ubuntu@<Instance-Public-IP>
Username: ubuntu
Key File: /path/to/your-key-pair.pem
Instance IP: Your instance public IP

Step 3: Verify LEMP Stack Installation

Once connected to your Ubuntu Server, verify all LEMP stack components are installed and operational using these methods:

Method 1: Verify Nginx Web Server

A. Check that Nginx is installed and running.
  1. Run the following command in your SSH terminal:

systemctl status nginx
  1. Verification: The output should show the service status as active (running)

Expected output:

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since...
  • active (running) = Nginx Server is operational and serving requests.
B. Check the Nginx version to confirm the installation.
  1. Run the following command in your SSH terminal:

nginx -v
  1. Verification: The output should return the Apache version information.

Expected output:

nginx version: nginx/1.24.x (Ubuntu)
  • Successful version output = Nginx Server is properly installed and configured.
Nginx Service status and Version

Method 2: Verify MySQL Database

A. Check that MySQL is installed and running.
  1. Run the following command in your SSH terminal:
systemctl status mysql
  1. Verification: The output should show the service status as active (running)

Expected output:

● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since...
B. Check the MySQL version to confirm the installation.
  1. Run the following command in your SSH terminal:
sudo mysql --version
  1. Verification: The output should return the Mysql version information.

Expected output:

mysql  Ver 8.0.x-0ubuntu0.24.04.x for Linux on x86_64 ((Ubuntu))
MySQL Service status and Version

Method 3: Verify PHP Installation

A. Check that PHP is installed and properly configured.
  1. Check PHP Version:
php -v
  1. Verification: The output should return the PHP version information.

Expected output:

PHP 8.x.x (cli) (built: ...)
Copyright (c) The PHP Group
Zend Engine v4.x.x
PHP version

Step 4: Test LEMP Stack Integration

Verify that all components work together by accessing the web server.

Test Web Server Access:

  1. Open a web browser
  2. Navigate to: http://<Your-Instance-Public-IP>
  3. You should see the default page with php and nginx info.
Default page on web with detail info