This README file provides detailed instructions for setting up a web server environment on an EC2 instance using the LAMP(Linux, Apache, MySQL, PHP) stack. The process involves installing and configuring Apache2, MySQL Server, PHP, and PHPMyAdmin. Follow the steps below for a successful setup. MAKE SURE YOU CHECK OUT HOW TO SETUP EC2 INSTANCE FOR LAMP
This repository is designed solely for educational purposes. The information, code, and resources provided here are intended to support learning and skill development. There is no warranty or support provided, and users should use the content at their own risk. The materials may not be suitable for production environments, and it is advised to review and modify them according to industry best practices at the time of use before deployment. Respect copyright and licensing terms associated with each resource. This repository is not affiliated with any organization or company. By using the materials herein, users agree to these terms.
To access the EC2 instance, use the following SSH command:
ssh -i "<key-pair-file-name>" <username>@<ip-address>
For example:
ssh -i "key.pem" king@1.2.3.4
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl status apache2
sudo systemctl enable apache2
sudo apt install mysql-server
sudo systemctl status mysql
sudo mysql_secure_installation
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'newpassword';
For Example:
CREATE USER 'king'@'localhost' IDENTIFIED BY 'ExamplePasswd@69';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
\q
sudo apt install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo apt install phpmyadmin
Note: Use MySQL user credentials created during mysql_secure_installation to log into PHPMyAdmin.
sudo nano /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.conf
sudo nano /var/www/html/index.php
This README file provides a step-by-step guide to set up an EC2 instance with Apache2, MySQL Server, PHP, and PHPMyAdmin. Follow these instructions carefully to establish a basic web server environment. For more information or troubleshooting, refer to the specific sections above.