In this short tutorial we will cover how to install Apache 2 on an aws ec2 instance ubuntu. if you have a question about installing Apache 2 on aws ec2 instance ubuntu then I will give a simple example with a solution. you can understand the concept of how to set up an Apache web server in Ubuntu.
Install Apache 2 on AWS EC2 Instance Running Ubuntu. Here, we will show you how to install the Apache 2 web server on an AWS EC2 instance running Ubuntu Linux.
Install Apache 2 on Ubuntu 18.04
Step 1: Connect Your AWS EC2 Intance from SSH
First, you need to connect your aws ec2 instance from ssh. If you are new to connecting the 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
In this step, you need to download the latest version of the software by first updating the local package index of Ubuntu repositories. So, start your ssh terminal and type the below-given command:
sudo apt update
Step 3: Install Apache 2
In this step, use the below-given command to install Apache 2 into your Ubuntu web server. So, open the ssh terminal again and run this sudo command to install the 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 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
Installing Apache2 web server on your Ubuntu 18.04 EC2 instance is completed. So, open your ssh terminal and type the below command to check the Apache 2 is installed or not on our Ubuntu 18.04 aws EC2 instance:
Congratulation!!, You have successfully installed the Apache 2 web server on the AWS ec2 instance.
If you want to access it from outside. So, you need to update the firewall settings on your Apache 2 web server on your Ubuntu 18.04 EC2 instance.
Setup Firewall with UFW on Ubuntu 18.04
Step 1: List the UFW application profiles
In this step, open your terminal ssh and type the following command to list such available firewall ufw applications:
sudo ufw app list
Step 2: Allow Apache Full on UFW
In this step, you need to allow Apache Full on UFW will open ports 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 3: Verify that the Apache service is running
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 2 web server on amazon ec2
I hope it can help you...