Introduction
The Apache server is the most broadly-used web server in the world. It provides many powerful features including :
- Dynamically loadable modules
- Powerful media support
- Perfect integration with other popular software
In this article, you will learn how to install an Apache server on your Ubuntu 18.04 server.
This blog also outlines information about important Apache folders and directories. Below are the steps that led to the installation of apache on ubuntu.
- Step 1 — Installing Apache:
Apache is available within Ubuntu’s default software, making it a chance to install it using conventional management tools.
Begin by updating the local package index :
sudo apt update
install the apache2 package:
sudo apt install apache2
After confirming the installation, it will install Apache.
- Step 2 — Adjusting the Firewall: Before testing, it’s necessary to change the firewall settings to allow external access to the default web ports.
During the installation, the server registers itself with UFW to give a few applications that can be used to.
Allow access to Apache through the firewall. List the ufw application profiles by running the following command:
sudo ufw app list
This will return a list of profiles:
Output
Available applications:
Apache
Apache Full
Apache Secure
OpenSSH
The above list shows that there are three profiles available for Apache server:
- Apache: profile opens only port 80
- Apache Full: profile opens both port 80 and port 443
Apache Secure: profile opens only port 443 Recommended that you access the most restrictive profile that will still access the traffic you’ve configured.
sudo ufw allow 'Apache'
Verify these changes:
sudo ufw status
Now the accessed HTTP traffic will be displayed like this:
Output
Status: active
To Action From
-- --- ---
OpenSSH ALLOW Anywhere
Apache ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Apache (v6) ALLOW Anywhere (v6)
The Apache profile has now been activated.
- Step 3 — Checking your Web Server: At the end of the installation, Ubuntu 18.04 starts Apache. The server should already be up and running.
Check with the systemd system to make sure the service is working:
sudo systemctl status apache2
Output
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset:
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Tue 2021-09-28 16:52:56 UTC; 1min 14s ago
Main PID: 9409 (apache2)
Tasks: 55 (limit: 4915)
CGroup: /system.slice/apache2.service
├─9409 /usr/sbin/apache2 -k start
├─9410 /usr/sbin/apache2 -k start
└─9411 /usr/sbin/apache2 -k start
This output shows that the service has started better. However, the perfect way to check this is to request a page from Apache.
You can access the default Apache page to confirm whether the software is running properly through your IP address.
If you do not know the server’s IP address, you can get it by using the command line.
Run the following command prompt:
hostname -I
You will receive a few addresses. You can try each in your web browser to check if they are running.
Step 4 — Managing the Apache Process: Now that you have your server up and working, let’s review some basic commands. You can stop the server with the command:
sudo systemctl stop apache2
To start the server when it is stopped:
sudo systemctl start apache2
You can stop and start the service by :
sudo systemctl restart apache2
Apache can often reload without dropping connections by:
sudo systemctl reload apache2
You can disable the behaviour of apache with the following:
sudo systemctl disable apache2
Alternatively, to enable o the service to start up at boot:
sudo systemctl enable apache2
Apache should now start automatically.
WOW! At last, you installed the Apache server on your Ubuntu.
If you have any doubts about the above topic or have to get cloud hosting services and consultations. Feel free to contact us. AIRZERO CLOUD will be your strong digital solution. E-mail id:[email protected]
Author - Johnson Augustine
Cloud Architect , Ethical hacker
Founder: Airo Global Software Inc
LinkedIn Profile: www.linkedin.com/in/johnsontaugustine/