Apache is the web server that processes requests and serves web assets and content via HTTP. MySQL is the database that stores all your information in an easily queried format. PHP is the programming language that works with apache to help create dynamic web content.
In this tutorial, i am going to show you how to install apache 2 web server on aws ec2 instance linux ubuntu 18.04 / 20.04 / 22.04.
How to Install Apache 2 on AWS Ubuntu Linux 18.04 / 20.04 / 22.04
Just use the below given steps to install Apache 2 on AWS ec2 instance on linux ubuntu 18.04 / 20.04 / 22.04 :
- Step 1: Connect Your AWS EC2 Intance from SSH
- Step 2: Update Ubuntu System Repositories
- Step 3: Install Apache 2 On AWS EC2 Instance
- Step 4: Verify the Apache installation
- Step 5: List the UFW application profiles
- Step 6: Allow Apache Full on UFW
- Step 7: Verify that the Apache service is running
Step 1: Connect Your AWS EC2 Intance from SSH
First of all, you need to connect your aws ec2 instance from ssh. If you are new to connect aws ec2 instance with windows, ubuntu and mac system. So you can read this tutorial “How to Connect to ec2 Instance From Putty and SSH Terminal“ to connect your ec2 instance from ssh.
Step 2: Update Ubuntu System Repositories
Once the connection is established, execute the following command on command line or terminal to download the latest version of the software by first updating the local package index of Ubuntu repositories:
sudo apt update
Step 3: Install Apache 2 On AWS EC2 Instance
Now open ssh terminal again and execute this sudo command to install apache web server on aws ec2 instance:
sudo apt install apache2
Note that, on running installation of apache 2 web server on aws ec2 instance. The prompt box will be open with a “Y/N” option to continue the installation.
Please enter Y, after which the installation process will begin.
Step 4: Verify the Apache installation
Execute the following command to check the Apache 2 is installed or not on our Ubuntu aws EC2 instance:
Congratulation!!, You have successfully installed the Apache 2 web server on AWS ec2 instance.
If you want to access it from outside. So, you need to update firewall settings on your apache 2 web server on your Ubuntu EC2 instance.
Step 5: List the UFW application profiles
Type the following command to list such available firewall ufw applications,:
sudo ufw app list
Step 6: Allow Apache Full on UFW
To allow Apache Full on UFW will open port 80 and 443 for network traffic, while providing maximum security to the server. So, use the below given UFW command to allow Apache Full through the following command:
sudo ufw allow 'Apache Full'
Step 7: Verify that the Apache service is running
Execute the following command on terminal or command line to verify apache services:
sudo systemctl status apache2
Finally, open your browser and type your AWS ec2 instance IP address. And, it will be looks like the Apache 2 page in the following picture:
Install apache on AWS ec2 instance ubuntu tutorial, You have learned how to install apache 2 on aws ec2 ubuntu.