Installing Apache Web Server on Ubuntu 22.04
- Last updated: Nov 3, 2023
- Views: 397
- Author: Admin
The Apache HTTP web server is the most widely used web server in the world. Apache has many different features that your site needs, including dynamically loaded modules, robust support for various media formats, and integration with other popular programs.
In this article, we will guide you on how to install the Apache web server on your Ubuntu 22.04 server. Before installing Apache, you must have a user with sudo privileges or perform all actions as root.
- Installing Apache.
- Firewall setting.
- Checking the work of the web server.
1. Apache installation.
The Apache package is available in the default Ubuntu repository and therefore Apache can be installed using the standard package management tools. To install the Apache web server, run the command:
$. sudo apt install apache2
Specify y and confirm the installation.
2. Firewall settings.
Now it's the turn to configure the firewall and open access to the Apache port. Now UFW blocks access to ports that are not in use (including the ports of the web server). Once installed, Apache registers with UFW, providing several profiles that can be used to enable or disable access to Apache through the firewall, let's take a look at this list.
To view a list of ufw application profiles, run the command:
$. sudo ufw app list
As you can see, we have three Apache profiles as a result.
- Apache profile only allows access on port 80.
- Apache Full - profile allows access on port 80 and port 443.
- Apache Secure profile only allows access on port 443.
We recommend that you enable the most strict Apache Secure profile, which will still support the current traffic, but since we have not yet configured an SSL certificate, we need to allow traffic on port 80, which means we will open the Apache profile.
The command to enable the Apache profile:
$. sudo ufw allow 'Apache'
Now let's check.
$. sudo ufw status
As you can see, as a result, our profile was activated to access the Apache web server.
3. We check the web server robot.
Now you can open any browser and enter the ip address of the server where we have Apache installed in the address bar.
If you did everything correctly, then you should see a welcome page.
Thank you all, I hope my article was of some help to you.