loader image
Drag
Contact Info

LAMP Stack with Load Balancing: High School Project

Project Overview

In my second year of high school, I undertook a solo project to build a LAMP stack using Docker containers. The stack ran Apache2 to serve a PHP website, with the PHP files stored on the host system. The project was hosted on an Ubuntu 22.04 virtual machine and included a MySQL container for database management. Additionally, I implemented load balancing using NGINX to efficiently distribute traffic across multiple web server containers.

Project Details

  • Container 1 (Web Server): The first c

    ontainer was a custom-built Ubuntu 22.04 image. It installed and ran Apache2 and PHP, while serving web pages from the host machine, ensuring flexibility in content management. This container was linked to a second container that handled the database.

  • Container 2 (Database): The second container used a standard MySQL image from Docker Hub. Permissions were adjusted to allow PHP to connect and interact with the database. Data persistence was ensured so that database contents would remain intact even if the containers were removed.
  • Load Balancing with NGINX: To improve performance and reliability, I set up a second web server container identical to the first. I configured NGINX for load balancing, allowing traffic to be distributed evenly between both web servers, ensuring better uptime and resource management.

Technologies Used

  • Docker: Used for containerization of both the web server (Apache2, PHP) and the database (MySQL).
  • Ubuntu 22.04 VM: The virtual machine environment on which the LAMP stack was built and tested.
  • NGINX: Implemented to balance the load across two web server containers, improving scalability and fault tolerance.
  • MySQL: Managed the database through a persistent container, ensuring data longevity even after container removal.

Challenges and Solutions

One of the main challenges was ensuring the seamless communication between containers and making sure the web server container correctly accessed the database. Adjusting the permissions and configuring persistent storage for the MySQL container helped resolve these issues. Implementing load balancing with NGINX added complexity but ultimately improved the performance of the system.

Explanation video’s

Github link

https://github.com/GiosSiebe/LAMPstackWithLoadBalancing

Conclusion

This project provided a foundational understanding of containerization, database management, and load balancing. It also taught me the importance of designing systems that are scalable, flexible, and resilient.

en_GB