<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MOTY</title>
    <description>The latest articles on DEV Community by MOTY (@moty12).</description>
    <link>https://dev.to/moty12</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1155211%2F71cc5490-487d-41bb-bb2e-ed87ac21e53f.jpeg</url>
      <title>DEV Community: MOTY</title>
      <link>https://dev.to/moty12</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moty12"/>
    <language>en</language>
    <item>
      <title>Deploy LAMP application on AWS</title>
      <dc:creator>MOTY</dc:creator>
      <pubDate>Wed, 04 Oct 2023 13:32:10 +0000</pubDate>
      <link>https://dev.to/moty12/deploy-lamp-application-on-aws-4ofg</link>
      <guid>https://dev.to/moty12/deploy-lamp-application-on-aws-4ofg</guid>
      <description>&lt;p&gt;In this article, you will learn how to implement a robust and secure LAMP (Linux, Apache, MySQL, PHP) stack on AWS, a cloud computing platform that provides powerful infrastructure and scalability, enabling you to deploy and manage web applications with ease and efficiency. I'll guide you through each step of setting up this popular web development environment on AWS, from configuring the Linux server to installing Apache, MySQL, and PHP, ensuring your web applications run smoothly and securely in the cloud. Whether you are a seasoned developer or just starting your journey into web development and cloud computing, this comprehensive guide will help you harness the full potential of AWS for hosting your LAMP-based projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;LAMP&lt;/strong&gt; is an acronym of four software technologies that developers use for building websites and web applications. It is denoted from LINUX an operating system, Apache a web server, mySQL a database server, and PHP, Python, and Perl a server-side programming language. LAMP is a stack&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS&lt;/strong&gt; means Amazon Web Services (AWS) is a secure cloud services platform, offering compute power and database storage and it helps Running web and application servers in the cloud to host dynamic websites. I'll be using a cloud server called Ec2 server which will enable us to use a virtual server and it offers a free tier account that we are going to leverage for this project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EC2&lt;/strong&gt; means elastic compute cloud. it is a virtual server that provides secure, resizable computing capacity in the cloud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apache server&lt;/strong&gt; An open-source web server software that serves web content to clients, handling requests and delivering web pages, making it a fundamental component of web hosting and website delivery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security group&lt;/strong&gt; acts as a firewall that controls the traffic allowed to and from the resources in your virtual private cloud (VPC).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DBMS&lt;/strong&gt; It means Database Management System, which is software that efficiently and securely manages the storage, retrieval, and organization of data in a database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;In order to proceed, I believe the reader has an AWS account because you will need an AWS account and a virtual server with Ubuntu Server OS else &lt;a href="https://portal.aws.amazon.com/billing/signup#/start/email"&gt;Click here&lt;/a&gt; to create an account. Stay calm and Let's make our hands dirty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Ec2 instance&lt;/strong&gt;&lt;br&gt;
Let's create a virtual server and install an Ubuntu OS on it. To create an instance below is the process.&lt;/p&gt;

&lt;p&gt;Firstly, we log on to our account, create an ec2 instance, install Ubuntu OS, and save your key pair(.pem) securely. &lt;a href="https://www.techtarget.com/searchcloudcomputing/tutorial/How-to-create-an-EC2-instance-from-AWS-Console"&gt;Click here&lt;/a&gt; for more details. or follow this below.&lt;/p&gt;

&lt;p&gt;After, an Ec2 instance is created then let's connect to the instance. if you are using Windows you connect using a tool called Putty and Mac users use their terminals to connect to their instance using SSH command. I'm a Mac user &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html"&gt;Click here&lt;/a&gt; for Windows users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6o5GeeZS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orbu7ehhikax8lorosyz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6o5GeeZS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orbu7ehhikax8lorosyz.png" alt="Image description" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Connect to Ec2 instance
&lt;/h2&gt;

&lt;p&gt;a. Open a terminal and locate the downloaded key pair file using this Linux command cd and your file directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd Downloads
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;b. Change permissions for the private key file, otherwise you can get an error&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;400 &amp;lt;private_file.pem&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;c. Connect to the instance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; &amp;lt;private-key-name&amp;gt;.pem ubuntu@&amp;lt;Public-IP-address&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install Apache and update firewall
&lt;/h2&gt;

&lt;p&gt;To install the Apache server we will use the Ubuntu package manager &lt;code&gt;apt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#update a list of packages in the package manager&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update

&lt;span class="c"&gt;#run apache2 package installation&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To ensure the apache2 is installed, use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the below image is your result then you are on the track. You have launched your web server. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YJjeKmMS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fakmfdb649toqa0lmh13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YJjeKmMS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fakmfdb649toqa0lmh13.png" alt="Image description" width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's update the firewall by configuring our security group inbound rules on the ec2 instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure EC2 instance  security inbound rules
&lt;/h2&gt;

&lt;p&gt;When the instance is created, we have a default TCP rule on port 22 opened which is useful for SSH connection to a terminal. In order to ensure that our webpage are being accessed on the internet, we need to open a TCP port 80 inbound rule.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eTa1FS9E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49dce03to7gxt5m8mbt6.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eTa1FS9E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49dce03to7gxt5m8mbt6.gif" alt="Image description" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check the accessibility of our web server on the internet, we curl the IP address/DNS name of our localhost.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; curl http://localhost:80
or
 curl http://127.0.0.1:80 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WAR2UXzK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ri0ltk43f5y8vprxeryb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WAR2UXzK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ri0ltk43f5y8vprxeryb.png" alt="Image description" width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To see if our web application server can respond to requests, use the public ip address of our instance on a web browser. http://:80 or without the port 'http://'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Dqm3BsLu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eg3b7b42odvef83tfomn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dqm3BsLu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eg3b7b42odvef83tfomn.png" alt="Image description" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing MySQL
&lt;/h2&gt;

&lt;p&gt;To install mysql server we use the command below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;mysql-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Installing PHP
&lt;/h2&gt;

&lt;p&gt;To install PHP, these 3 packages need to be installed together&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;php libapache2-mod-php php-mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;once the installation is done use the command below to ensure it is installed and check the version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;php &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gGi2vABT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zw9ga7bckpphzt0om1du.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gGi2vABT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zw9ga7bckpphzt0om1du.png" alt="Image description" width="800" height="114"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy your PHP website
&lt;/h2&gt;

&lt;p&gt;Create a new directory &lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; /var/www/&amp;lt;directory_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assign ownership of the directory to your current system user&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; &lt;span class="nv"&gt;$USER&lt;/span&gt;:&lt;span class="nv"&gt;$USER&lt;/span&gt; /var/www/&amp;lt;directory_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create and open a new configuration file in Apache’s sites-available directory using your preferred command-line editor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vi /etc/apache2/sites-available/&amp;lt;directory_name&amp;gt;.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command above will create a new file and you will paste this code into it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;VirtualHost &lt;span class="k"&gt;*&lt;/span&gt;:80&amp;gt;
    ServerName proj&amp;lt;directory_name&amp;gt;ectlamp
    ServerAlias &amp;lt;directory_name&amp;gt; 
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/&amp;lt;directory_name&amp;gt;
    ErrorLog &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;APACHE_LOG_DIR&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/error.log
    CustomLog &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;APACHE_LOG_DIR&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;/access.log combined
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To save and close the file, follow the steps below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hit the esc button on the keyboard&lt;/li&gt;
&lt;li&gt;Type :&lt;/li&gt;
&lt;li&gt;Type wq. w for write and q for quit&lt;/li&gt;
&lt;li&gt;Hit ENTER to save the file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can use &lt;code&gt;ls&lt;/code&gt; to list the document in the directory &lt;/p&gt;

&lt;p&gt;Run esc &lt;code&gt;:wq&lt;/code&gt; to save and terminate vi editor.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;sudo a2ensite projectlampstack&lt;/code&gt; to activate the server block.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;sudo a2dissite 000-default&lt;/code&gt; to deactivate the default web server block that comes with Apache on default.&lt;/p&gt;

&lt;p&gt;Reload the apache2 server &lt;code&gt;sudo systemctl reload apache2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create an index file inside your directory &lt;code&gt;/var/www/&amp;lt;folder_name&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /var/www/&amp;lt;folder_name&amp;gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write your HTML code into the file using &lt;code&gt;sudo vi &amp;lt;filename&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;&lt;span class="o"&gt;!&lt;/span&gt;DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;&lt;span class="nb"&gt;head&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &amp;lt;title&amp;gt;01. LAMP stack implementation&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;hello world&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To save and close the file, follow the steps below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hit the ESC button on the keyboard&lt;/li&gt;
&lt;li&gt;Type :&lt;/li&gt;
&lt;li&gt;Type wq!&lt;/li&gt;
&lt;li&gt;Hit ENTER to save the file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go to your browser and try to open your website URL using your public IP address:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;http://&amp;lt;Public-IP-Address&amp;gt;:80&lt;/code&gt; or &lt;code&gt;http://&amp;lt;Public-IP-Address&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aQA0sfR2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0l0r2gitnthnu3380vrg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aQA0sfR2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0l0r2gitnthnu3380vrg.png" alt="Image description" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Enable PHP on the website&lt;/h3&gt;

&lt;p&gt;By default, in Apache, if both an index.html and an index.php file exist in a directory, the server will prioritize displaying the index.html file over the index.php file. This feature can be advantageous when configuring maintenance pages for PHP applications. You can achieve this by temporarily creating an index.html file with informative content for visitors. Since the index.html page takes precedence over the index.php page, it becomes the primary landing page for your application during maintenance. Once the maintenance work is completed, you can either rename or delete the index.html file from the document root, restoring the regular application page.&lt;/p&gt;

&lt;p&gt;If you wish to modify this behavior and give priority to the index.php file, you'll need to edit the &lt;code&gt;/etc/apache2/mods-enabled/dir.conf file&lt;/code&gt;. Inside this file, you can adjust the order in which the index.php file is listed within the DirectoryIndex directive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim /etc/apache2/mods-enabled/dir.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;IfModule mod_dir.c&amp;gt;
     &lt;span class="c"&gt;#Change this:&lt;/span&gt;
    &lt;span class="c"&gt;#DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm&lt;/span&gt;
    &lt;span class="c"&gt;#To this:&lt;/span&gt;
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
&amp;lt;/IfModule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After we save the file, we need to reload the Apache&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl reload apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a PHP file to test if PHP is set correctly and configured&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;vim /var/www/&amp;lt;folder_name&amp;gt;/index.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write your PHP code and save. Below is a sample code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;?php
phpinfo&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go to your browser and open your website URL using your public IP address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://&amp;lt;Public-IP-Address&amp;gt;:80 or http://&amp;lt;Public-IP-Address&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U7fJJKky--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xc42zxixrabppqntdyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U7fJJKky--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0xc42zxixrabppqntdyl.png" alt="Image description" width="800" height="477"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations on successfully deploying your LAMP stack on AWS! You've achieved a significant milestone.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>linux</category>
      <category>php</category>
    </item>
  </channel>
</rss>
