How to Install the Apache Web Server on Ubuntu

In this article we will install the Apache Web Server on Ubuntu

You should have a regular, non-root user with sudo privileges configured on your server. When you have an account available, log in as your non-root user to begin. 

Installation

There are many ways to install the Apache web Server on Ubuntu. Here we will use the easy ways to install. In the terminal run the below Commands

sudo apt update

Then, install the apache2 package:

sudo apt install apache2

After confirming the installation, apt will install Apache and all required dependencies.

Before testing Apache, it’s necessary to modify the firewall settings to allow outside access to the default web ports.During installation, Apache registers itself with UFW to provide a few application profiles that can be used to enable or disable access to Apache through the firewall.

We will only need to traffic on port 80:

sudo ufw allow 'Apache'

You can check the ufw status using below command

sudo ufw status

Output:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere                  
Apache                     ALLOW       Anywhere                
OpenSSH (v6)               ALLOW       Anywhere (v6)             
Apache (v6)                ALLOW       Anywhere (v6)

List the ufw application profiles by typing: 

sudo ufw app list

You will receive a list of application profiles:

 

Output
Available applications:
  Apache
  Apache Full
  Apache Secure
  OpenSSH

 Checking your Web Server

 At the end of the installation process, The web server should already be running.

sudo systemctl status apache2

As confirmed by this output, the service has started successfully. However, the best way to test this is to request a page from Apache. 

If you have your server IP address then You can access the default Apache landing page to confirm that the software is running properly through your IP address.enter it into your browser’s address bar:

http://your_server_ip

You should see the default Ubuntu 20.04 Apache web page:

Apache default page 

I hope it will help you.