This post shows students and new users the steps to install, configure and use the Apache HTTP web server on Ubuntu Linux. Apache is the most popular open source web server in the world. Most likely, many of the websites you visit today are running the Apache HTTP server.
If you are thinking of running a website, you are more likely to choose Apache or have Apache support from web hosting companies than other web servers. Apache provides powerful functions that can be extended by a wide variety of modules.
If you are a student or a new user learning Linux, the easiest place to start learning is on Ubuntu Linux. Ubuntu is the modern open source Linux operating system for desktops, servers, and other devices.
To start installing Apache HTTP server on Ubuntu Linux, follow the steps below.
How to use Apache HTTP server on Ubuntu Linux
As mentioned above, Apache is widely used on the internet. If you want to learn how to install and use it on Ubuntu Linux, continue below.
Apache is available in the Ubuntu repositories, so we can easily install it using the suitable package management tool.
To install Apache, run the following commands:
sudo apt update sudo apt install apache2
The above commands will install the Apache HTTP server.
Now to find out if Apache is actually installed and running, use the health check command below.
sudo systemctl status apache2
The command will generate similar lines below when Apache is running.
How to allow Apache through the Ubuntu firewall
If you are running Ubuntu in protected mode with the firewall enabled, you will have to allow HTTP (80) and HTTPS (443) to the Apache web server. In most cases, the Ubuntu server runs without the firewall enabled. However, run the following commands if you are unsure.
If you are using UFW to manage the Ubuntu firewall, run the following commands to allow traffic.
sudo ufw allow 'Apache Full'
That will allow full traffic to Apache.
With the firewall open, just look up the server’s hostname or IP address to see if the Apache default page is active.
You should see Apache’s default welcome page.