Home Linux guides How to Install and Configure Apache on Rocky Linux 8.

How to Install and Configure Apache on Rocky Linux 8.


The Apache HTTP Server aka Apache is a free and open-source cross-platform web server software released under the terms of Apache Licence 2.0. Being cross-platform, it operates in modern Operating systems including UNIX and Windows. Apache server is one of the most popular and powerful web servers in the world due to its ease of administration and flexibility. It is designed to provide a secure, efficient, and extensible server that provides HTTP service concurring with the current HTTP standards.

As of this article, the stable release available for download is release 2.4.49 released on 16th September 2021.

Features of Apache Webserver.

  • UNIX Threading – Apache Server can now run on UNIX systems with POSIX threads support. It can now run in a hybrid multi-process multi-threaded mode. This makes Apache Server very scalable.
  • Multiprotocol support – Apache HTTP server has some infrastructure in place to support multiple protocols. e.g mod_echo.
  • Better support for non-UNIX users – Apache HTTP Server 2.0 is faster and more stable on non-Unix platforms such as BeOS, OS/2, and Windows.
  • New Apache httpd API – The API for modules has changed significantly for 2.0. This is because module-ordering / priority is automatically done with 2.0. module ordering is now done per-hook to allow more flexibility. new calls have been added that provide additional module capabilities without patching the core Apache HTTP Server.
  • IPv6 Support – On systems where IPV6 is supported, Apache httpd gets IPv6 listening sockets by default.
  • Filtering – Apache httpd modules are now written as filters which act on the stream of content as it is delivered to or from the server.
  • Multilanguage Error Responses – Error response messages to the browser are now provided in several languages, using SSI documents. They are hence easily customizable to achieve a consistent look and feel.
  • Simplified configuration – Many confusing directives have been simplified. The often confusing Port and BindAddress directives have been dropped. Only the listen directive is used for IP Address binding. The server name directive specifies the server name and port number only.
  • Native Windows NT Unicode Support – Apache httpd 2.0 on Windows NT now uses utf-8 for all filename encodings. This provides multilanguage support for all Windows NT-based installations.
  • Regular Expression Library Updated – Apache httpd 2.0 includes the Perl Compatibe Regular Expression Library (PCREL).All regular expression evaluation now uses the more powerful Perl 5 syntax

In this article, I will take you through how to install Apache on Rocky Linux 8.

Step 1 : Install Apache.

To install Apache carry out the following steps.

Clean-up dnf

To clean up dnf, run the command clean all.

sudo dnf clean all

Update and upgrade your system.

As a matter of best practice ensure your system is updated and upgraded before any installation.

sudo dnf -y update 
sudo dnf -y upgrade 

Install Apache

Execute the command below to install Apache Webserver.

sudo dnf -y install httpd

Bravo, you have successfully installed the Apache webserver on your Rocky Linux 8.

Step 2 : Allow Apache through the Firewall

Allow the default HTTP and HTTPS port, ports 80 and 443 through the firewall by running the command below.

sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp

Reload the firewall

sudo firewall-cmd --reload

Step 3 : Configure Apache to start on Boot.

To configure Apache to start on boot, carry the steps below.

Start Apache service.

sudo systemctl start httpd

If the above command throws in an error, ensure you stop the nginx service then execute the command again. To stop the nginx service, simply run the command below.

sudo systemctl stop nginx

After successfully starting the Apache service, enable the Apache service to start on boot by running the command below.

sudo systemctl enable httpd

If successful, you should notice a symbolic link is created as shown on the command output below.

[[email protected] ~]$ sudo systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

Congratulations you have successfully configured the Apache Webserver.

Step 4 : Other useful commands for Apache

To check the Apache Status run the command below.

sudo systemctl status httpd

The command output

[[email protected] ~]$ sudo systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor prese>
  Drop-In: /usr/lib/systemd/system/httpd.service.d
   Active: active (running) since Thu 2021-09-23 14:57:00 EAT; 9min ago
     Docs: man:httpd.service(8)
 Main PID: 15983 (httpd)
   Status: "Running, listening on: port 80"
    Tasks: 213 (limit: 48892)
   Memory: 38.7M
   CGroup: /system.slice/httpd.service
           ├─15983 /usr/sbin/httpd -DFOREGROUND
           ├─15990 /usr/sbin/httpd -DFOREGROUND
           ├─15991 /usr/sbin/httpd -DFOREGROUND
           ├─15992 /usr/sbin/httpd -DFOREGROUND
           └─15993 /usr/sbin/httpd -DFOREGROUND

Sep 23 14:57:00 rocky-linux systemd[1]: Starting The Apache HTTP Server...

From the screenshot, our Apache server is loaded, active, and running.

To stop Apache, run the command below.

sudo systemctl stop httpd


That sums up our article on “How to install Apache in Rocky Linux 8”. We hope the article was helpful to you. Feel free to write a comment below. Keep checking for more articles. Thank you.


Please enter your comment!
Please enter your name here