How to install and configure apache on your Linux server

Learn how to configure apache on your Linux server

· 3 min read
How to install and configure apache on your Linux server

Hello, everyone, I am Shashikant Dwivedi and in this article, I’m going to demonstrate, how you can set up apache on your Linux server.

Apache is used to create an HTTP server, in which we host our web applications.

So before heading toward the procedure there is some prerequisite that you must have. The prerequisite is -

If you don’t have a Linux server, you can create one for yourself from AWS. Go through this article to create a Linux server.

How To Create An Linux Server Using Aws For Free
Learn how to launch a Linux server using AWS for free.

If you have all the prerequisite things then let’s move on to the steps.

Steps

  1. Firstly connect to your ubuntu server. For this open, the Instances tab on your EC2 dashboard in AWS account and copy the IPv4 public IP. Then open your terminal and types this command
ssh -i private-key.pem ubuntu@your-public-ip

2. Now update and upgrade your Linux server by using commands

sudo apt-get update
sudo apt-get upgrade

3. Now install the Apache server using this command

sudo apt-get install apache2

4. Now check if the firewall is enabled or not if enabled then enable it by command

sudo ufw status

If this shows status: inactive.Then allow it by command

sudo ufw enable

5. Now enable apache and ssh in ufw by commands

sudo ufw allow 'Apache Full'
sudo ufw allow '22'

6. Now from the server side, all things are configured now it's time to do some changes from the EC2 dashboard in the AWS dashboard.

7. Open security groups from the EC2 instance tab.

8. Now open the Inbound tab and press the edit button.

9. Now just add the HTTP rule and make it available from everywhere and save this configuration.

10. Now just copy your server's public IP and paste it into the browser.

So just by following these 10 steps, you can easily set up an apache server.
Hope you have liked the article. And if you have any problems, you can ask me in the comment section.