SlideShare a Scribd company logo
1 of 21
Download to read offline
Apache
Hosting a Web-Application on
Server using a Linux
EC2 instance on AWS
by Ayomide Ogunsanya (@TheCloudLord)
INTRO
In this Project, i’ll be Launching an EC2 instance on AWS - ssh
into the instance using Git bash on my local machine - Install
Apache on the EC2 instance and Host a Web app in Apache.
The procedures are documented as clear as possible.
1.
Launch a Linux EC2 instance, on my case i used the Amazon
Linux EC2 free tier - Make sure you have your EC2 instance
inbound Security groups (2) set as (ssh port 22, source type set
to my IP) and for the second inbound rule, set as (http port 80,
source type set to Anywhere) before launching
2.
3.
Now, lets shh into our EC2 instance using our Local machine -
Click on Connect
4.
5.
Select SSH Client
6.
Locate your Private Key on your local computer - select it and right click
outside of it - from the drop down menu select Open Git Bash here to open Git
bash directly in the Private key path - Now paste command no 3 from your EC2
instance SSH Client into your Git Bash as shown
7.
then go ahead copy and paste the ssh command from your SSH Client to your Git
bash and now we have successfully ssh into our EC2 instance
Now, Lets install APACHE
Server on our EC2
instance
8.
for this, we would be running the following linux commands
sudo su
yum update -y
yum install -y httpd
sudo su to switch into superuser mode - yum update to update
our EC2 instance and - yum install to install our APACHE Server
9.
Now our APACHE Server has been Succesfully installed on our EC2
Instance
10.
Now, the Next Step is to cd into our html directory which is where
our Web App files would run from. This is done using the full path
command cd /var/www/html
Now lets download the Web app files into the html directory, this
is done by using the wget command.
I have my web app files uploaded already on my Github account
from my local computer so i would download from there. to do
this, simply go to your Github repository - click on code - go to
download zip - right click - click on copy link address
11.
right click and
click Copy link
address
12.
Now execute the command wget
https://github.com/TheCloudLord/Static-website-for-ec2-
use/archive/refs/heads/main.zip to download the web app files into
our apache server
Now use ls command to check if the downloaded file is present in
the html directory
Once we have our file present ‘main.zip’ the next thing is to unzip
the file.
13.
this is done using the unzip command
now we have unzipped succefully
Next is to move the Web App files inside the unzipped folder into the html directory to
enable our apache server run the web app, itself this is done by executing the
command cp -r Static-website-for-ec2-use-main/* /var/www/html/ and the executing
the command cp -r inance-html/* /var/www/html/ to copy completely from the inance-
html folder to the html directory
14.
Now our web app files is succesfully in the html directory and ready to be accessed
from the internet
15.
execute the command rm -rf inance-html main.zip Static-website-for-ec2-use-main to
delete duplicate files or leave if you want - Finally execute the following commands
systemctl enable httpd
systemctl start httpd to enable APACHE Server start on system boot up.
Now our Web app is succesfully hosted our web app on our Apache Server
16.
Now lets access our Web Application through the internet - Go to your EC2
Instance Dashboard on AWS - Copy and Paste the Public IPv4 address on a new
tab on your Browser to access the Web App.
17.
Our Web App is running perfectly well on our Apache Server.
Do make sure you Terminate your EC2 instance after this task to avoid
Incurred Bills.
Thanks For
Following
Lets Connect
Gmail : ayomideogunsanya@gmail.com
LinkedIn : https://www.linkedin.com/in/thecloudlord/
X : https://twitter.com/TheCloudLord_

More Related Content

Similar to Host a Web Application on an Apache Server while Running the Server on an EC2 instance.

Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Boxguest34a3a419
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows BoxJayanta Dash
 
Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10Maurício Linhares
 
Diva23
Diva23Diva23
Diva23diva23
 
Installing WordPress on AWS
Installing WordPress on AWSInstalling WordPress on AWS
Installing WordPress on AWSManish Jain
 
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPHow To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPMatt Dunlap
 
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptxCiceer Ghimirey
 
Project-make a public website server using raspberry pi
Project-make a public website server using raspberry piProject-make a public website server using raspberry pi
Project-make a public website server using raspberry piFahim Hossain
 
Wamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and ConfigurationWamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and ConfigurationChetan Soni
 
Setting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdfSetting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdfShaiAlmog1
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environmentSoshi Nemoto
 
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTYWilliam Chong
 
Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2IMC Institute
 
Google cloud essential skills challenge lab
Google cloud essential skills challenge labGoogle cloud essential skills challenge lab
Google cloud essential skills challenge labMahmmoud Mahdi
 
Deploy django apps using docker
Deploy django apps using dockerDeploy django apps using docker
Deploy django apps using dockerThomas Kremmel
 
Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLkangaro10a
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windowsDocker, Inc.
 
Automation of web attacks from advisories to create real world exploits
Automation of web attacks from advisories to create real world exploitsAutomation of web attacks from advisories to create real world exploits
Automation of web attacks from advisories to create real world exploitsMunir Njiru
 

Similar to Host a Web Application on an Apache Server while Running the Server on an EC2 instance. (20)

Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Box
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Box
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10Deploying your rails application to a clean ubuntu 10
Deploying your rails application to a clean ubuntu 10
 
Diva23
Diva23Diva23
Diva23
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
Installing WordPress on AWS
Installing WordPress on AWSInstalling WordPress on AWS
Installing WordPress on AWS
 
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPHow To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
 
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx Install LAMP Stack  in Linux Server OS and Hosting a Custom Domain .pptx
Install LAMP Stack in Linux Server OS and Hosting a Custom Domain .pptx
 
Project-make a public website server using raspberry pi
Project-make a public website server using raspberry piProject-make a public website server using raspberry pi
Project-make a public website server using raspberry pi
 
Wamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and ConfigurationWamp & LAMP - Installation and Configuration
Wamp & LAMP - Installation and Configuration
 
Setting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdfSetting Up a Cloud Server - Part 3 - Transcript.pdf
Setting Up a Cloud Server - Part 3 - Transcript.pdf
 
Instruction: dev environment
Instruction: dev environmentInstruction: dev environment
Instruction: dev environment
 
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
 
Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2Set up Hadoop Cluster on Amazon EC2
Set up Hadoop Cluster on Amazon EC2
 
Google cloud essential skills challenge lab
Google cloud essential skills challenge labGoogle cloud essential skills challenge lab
Google cloud essential skills challenge lab
 
Deploy django apps using docker
Deploy django apps using dockerDeploy django apps using docker
Deploy django apps using docker
 
Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQL
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
Automation of web attacks from advisories to create real world exploits
Automation of web attacks from advisories to create real world exploitsAutomation of web attacks from advisories to create real world exploits
Automation of web attacks from advisories to create real world exploits
 

Recently uploaded

Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)ChandrakantDivate1
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxpritamlangde
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORTanishkaHira1
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelDrAjayKumarYadav4
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementDr. Deepak Mudgal
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdfAlexander Litvinenko
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 

Recently uploaded (20)

Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSORINTERRUPT CONTROLLER 8259 MICROPROCESSOR
INTERRUPT CONTROLLER 8259 MICROPROCESSOR
 
Path loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata ModelPath loss model, OKUMURA Model, Hata Model
Path loss model, OKUMURA Model, Hata Model
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Ground Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth ReinforcementGround Improvement Technique: Earth Reinforcement
Ground Improvement Technique: Earth Reinforcement
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 

Host a Web Application on an Apache Server while Running the Server on an EC2 instance.

  • 1. Apache Hosting a Web-Application on Server using a Linux EC2 instance on AWS by Ayomide Ogunsanya (@TheCloudLord)
  • 2. INTRO In this Project, i’ll be Launching an EC2 instance on AWS - ssh into the instance using Git bash on my local machine - Install Apache on the EC2 instance and Host a Web app in Apache. The procedures are documented as clear as possible.
  • 3. 1. Launch a Linux EC2 instance, on my case i used the Amazon Linux EC2 free tier - Make sure you have your EC2 instance inbound Security groups (2) set as (ssh port 22, source type set to my IP) and for the second inbound rule, set as (http port 80, source type set to Anywhere) before launching
  • 4. 2.
  • 5. 3.
  • 6. Now, lets shh into our EC2 instance using our Local machine - Click on Connect 4.
  • 8. 6. Locate your Private Key on your local computer - select it and right click outside of it - from the drop down menu select Open Git Bash here to open Git bash directly in the Private key path - Now paste command no 3 from your EC2 instance SSH Client into your Git Bash as shown
  • 9. 7. then go ahead copy and paste the ssh command from your SSH Client to your Git bash and now we have successfully ssh into our EC2 instance
  • 10. Now, Lets install APACHE Server on our EC2 instance
  • 11. 8. for this, we would be running the following linux commands sudo su yum update -y yum install -y httpd sudo su to switch into superuser mode - yum update to update our EC2 instance and - yum install to install our APACHE Server
  • 12. 9. Now our APACHE Server has been Succesfully installed on our EC2 Instance
  • 13. 10. Now, the Next Step is to cd into our html directory which is where our Web App files would run from. This is done using the full path command cd /var/www/html Now lets download the Web app files into the html directory, this is done by using the wget command. I have my web app files uploaded already on my Github account from my local computer so i would download from there. to do this, simply go to your Github repository - click on code - go to download zip - right click - click on copy link address
  • 14. 11. right click and click Copy link address
  • 15. 12. Now execute the command wget https://github.com/TheCloudLord/Static-website-for-ec2- use/archive/refs/heads/main.zip to download the web app files into our apache server Now use ls command to check if the downloaded file is present in the html directory Once we have our file present ‘main.zip’ the next thing is to unzip the file.
  • 16. 13. this is done using the unzip command now we have unzipped succefully
  • 17. Next is to move the Web App files inside the unzipped folder into the html directory to enable our apache server run the web app, itself this is done by executing the command cp -r Static-website-for-ec2-use-main/* /var/www/html/ and the executing the command cp -r inance-html/* /var/www/html/ to copy completely from the inance- html folder to the html directory 14. Now our web app files is succesfully in the html directory and ready to be accessed from the internet
  • 18. 15. execute the command rm -rf inance-html main.zip Static-website-for-ec2-use-main to delete duplicate files or leave if you want - Finally execute the following commands systemctl enable httpd systemctl start httpd to enable APACHE Server start on system boot up. Now our Web app is succesfully hosted our web app on our Apache Server
  • 19. 16. Now lets access our Web Application through the internet - Go to your EC2 Instance Dashboard on AWS - Copy and Paste the Public IPv4 address on a new tab on your Browser to access the Web App.
  • 20. 17. Our Web App is running perfectly well on our Apache Server. Do make sure you Terminate your EC2 instance after this task to avoid Incurred Bills.
  • 21. Thanks For Following Lets Connect Gmail : ayomideogunsanya@gmail.com LinkedIn : https://www.linkedin.com/in/thecloudlord/ X : https://twitter.com/TheCloudLord_