This article explains how to Install Apache Web Server on Ubuntu 20.04. I will introduce what Apache Web Server is and it’s main features and navigate to installation steps.
What is Apache Web Server?
Apache is a reliable web server software maintained and developed by the Apache Software Foundation. Its first version got released in 1995 with the aim to provide a secure server to users that helps sync HTTP services with the current HTTP standards. Today, most developers, hosting providers and website owners use Apache server because it is a free and open source web server compatible with every operating system and provides excellent performance.
Firstly, Apache HTTP Web Server is not any physical server but software that helps transfer files back and forth between clients and servers. Apache web server role is to create a link between the servers and web browsers (Google Chrome, Firefox, etc.) for delivering web content.
It is written in C language, easy to configure and stands one of the fastest software that helps establish a smooth and secure connection between two sources. Let’s say, for instance, if a visitor wants to open a page on the website, the web browser will immediately inform the server, and Apache will help deliver the requested files in response. Furthermore, its open source infrastructure is of great advantage to developers as they can view and customize the source code as per the need.
In addition, the software offers various modules for web security, caching, password authentication, and more. mod_domain, mod_mbox, mod_ftp, Sandbox, mod_pop3, mod_smtpd, are a few modules provided by the software. In order to configure them, you will require permission to use .htaccess. Server administrators can manage these additional functionalities and eliminate unwanted modules as per the need. Thus, turning Apache into more lightweight and efficient software. The best part about choosing Apache web server over other web servers is it can handle heavy traffic with minimal configurations.
Finally Apache server uses an HTTP protocol to accept requests from internet users and deliver the requested information as files and Web pages. You can run this software on various operating systems, including Windows, Linux, FreeBSD, Mac OS X, Novell Netware, Solaris, etc. LinkedIn, Facebook, Salesforce, Siemens, eBay, Cisco, IBM are a few high profile companies that use Apache Web Server.
Apache web server is a good choice for enterprises looking forward to running a website on a stable platform. It is one of the oldest web servers and can handle heavy traffic. Check out some of the key features of the Apache webserver software.
Apache is free, open source software that is easy to view and customize.
Fast, secure and easy to configure webserver software.
Flexible module based structure.
Supports various programming languages, such as PHP, Python, etc.
By default, the Apache webserver is included in the Ubuntu default repository. You can install it by just running the following command:
apt-get install apache2 -y
This will install the Apache webserver to your system and also starts the Apache service. By default, Apache listens on port 80. You can check it with the following command:
ss -antpl | grep 80
You will get the following output:
LISTEN 0 511 *:80 *:*
Now, open your web browser and access the Apache test page using the URL http://your-server-ip. You should see the Apache test page in the following screen:
Next step of how to Install Apache Web Server on Ubuntu 20.04 is virtual hosting. Apache provides virtual hosting feature that allow you to host multiple websites on a single server. In this section, we will host a new website using the domain name web1.example.com.
Create a Website Directory
First, you will need to create a directory for your new website:
mkdir /var/www/html/example.com
Next, change the ownership of your website directory to www-data:
Next, you will need to create an Apache virtual host configuration file to serve the index.html file over the internet. You can create it with the following command:
At this point, the Apache web server is configured to serve the index.html page via web1.example.com domain. You can now test it using the URL http://web1.example.com in your web browser. You should see the following page:
Install Apache Web Server on Ubuntu 20.04 Conclusion
In the above guide, we explained how to install the Apache webserver on Ubuntu 20.04. We have also explained how to use virtual hosting to host a website on the internet. I hope this guide will help you to host multiple websites on a single server.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.