Open larrymie opened 3 years ago
STEP 1 — INSTALLING APACHE AND UPDATING THE FIREWALL
After creation of a new AWS account, I launched a new EC2 instance of t2.micro family with Ubuntu Server 20.04 LTS (HVM). As a Windows user, I used putty to connect to my EC2 Instance as found in the image below (01) below
The command
I opened my chrome browser and typed http://
STEP 2 — INSTALLING MYSQL
I installed a Database Management System (DBMS) to be able to store and manage data for my site in a relational database using the command
A security script that comes pre-installed with MySQL was runned using the command
I created a new strong password, Image 7 and 8
STEP 3 — INSTALLING PHP
PHP is the component of our setup that will process code to display dynamic content to the end user. I installed php-mysql and libapache2-mod-php with it simultaneously using the command sudo apt install php libapache2-mod-php php-mysql. image 9.
STEP 4 — CREATING A VIRTUAL HOST FOR MY WEBSITE USING APACHE
I create a directory for projectlamp using ‘mkdir’ command as follows: <sudo mkdir /var/www/projectlamp> Next I assigned ownership of the directory with my current system user: <sudo chown -R $USER:$USER /var/www/projectlamp> I then used a command line editor to create and open a new configuration file in Apache using the command <sudo vi /etc/apache2/sites-available/projectlamp.conf> as seen in image (10) , (11) , (12) , (13) and (14)
STEP 5 — ENABLE PHP ON THE WEBSITE
I edited the behavior of the file, changed the order in which the index.php file is listed within the DirectoryIndex directive using the command: <sudo vim /etc/apache2/mods-enabled/dir.conf>
Pasted the below and saved it.
I reloaded the Apache for the changes to take effect; using
I created a PHP script to test that PHP is correctly installed and configured on my server.
Now that I have a custom location to host my website’s files and folders, I will create a PHP test script to confirm that Apache is able to handle and process requests for my PHP files.
Create a new file named index.php inside your custom web root folder:
vim /var/www/projectlamp/index.php This will open a blank file. Add the following text, which is valid PHP code, inside the file:
<?php phpinfo();
Image 15 and 16
Finally! I refreshed my chrome browser page and this was displayed: image 17
Image 17 confirmed that my PHP installation is working as expected.
nt.com/91284177/137761224-de05a37b-11a6-4e9c-b78d-393f38946680.png)