Skip to content

Latest commit

 

History

History
85 lines (56 loc) · 3.62 KB

File metadata and controls

85 lines (56 loc) · 3.62 KB

Deploying a LAMP (Linux,Apache,Mysql,PhP) Stack application (LAMP STACK) on AWS Cloud

In this project, I setup a application for serving PHP websites and applications to website visitors, using LAMP Stack which make use a Linux server, Apache, an open source software for serving web pages; as web server and MySQL as database management system.

First Step: Launch EC2 instance on AWS cloud and Install Apache & update the server

  1. Lauch a Linux EC2 instance on AWS Cloud. Launch EC2 instance

  2. Update packages in package manager. Update packages

  3. Run command (sudo apt install apache2) for apache installation. install apache

  4. Verify successful installtion (run sudo systemctl status apache2). verify installation

  5. run command (curl http://127.0.0.1:80 or http://localhost:80) to Check how to access the webserver locally. webserver Local access webserver Local access

  6. Add inbound rule for HTTP on AWS instance. Add inbound rule

  7. Access webserver(via public IP) via Browser. Access webserver

Second Step: Installed mysql server

  1. Run installation command. Install mysql

  2. Test login. Install mysql

Thrid Step: Installing PHP

  1. Run sudo apt install php libapache2-mod-php php-mysql to Install PHP, PHP-mysql and libapache2-mod-php. Install PHP

  2. check php version (php -v) check PHP version

Forth Step: Setup Apache Virtual Host for websites

  1. Create new domaian directory -projectlamp create domain directory

  2. Assign directory ownership to current root user. assign domain ownership

  3. Create and open a new configuration file (for projectlamp) in Apache’s sites-available directory. create config file for projectlamp

  4. Show the new file in the sites-available directory. the new file in apachesite

  5. Enabled the new virtual host (with sudo a2ensite projectlamp ) the new virtual host enabled

  6. Disable default apache website, ensure config file is void of syntax error and reload Apache to save changes. default apache website disabled

  7. Create index.html file in the new active web root. index.html created in web root

  8. Open index.html in a browser with IP and DNS using IP & DNS to access index.html in browser using IP & DNS to access index.html in browser

Fifth Step: Enable PHP on the website

  1. Since Index.html takes precidence over index.php by default then change precidence. let index.php preceed index.html

  2. Create new file index.php in custom web root folder(with vim /var/www/projectlamp/index.php) create index.php

  3. Refresh url to check that php is installed and working. refresh url that php is istalled

  4. Remove index.php to protect server sensitive information. remove index.php