How to Install Apache Web Server on CentOS 8

Apache is the most popular web server application. It has been used widely among individuals and companies. Apache can be installed on almost any operating system including Windows, Linux even Raspberry Pi. In this tutorial, I am going to install Apache Web Server on CentOS 8. The Apache package is available in CentOS 8 repository so it is pretty easy to install it.

Steps to Install Apache Web Server on CentOS 8

Open Terminal and login as root. And then simply use this command to install Apache on CentOS 8

su
dnf install httpd

Once the installation is complete, enable and start the webserver

systemctl start httpd
systemctl enable httpd

Now check the status

systemctl status httpd

Adjust the Firewall

We need to modify the firewall setting so it will allow http (port 80) and https (port 443)connection.

firewall-cmd --permanent --zone=public --add-service=http 
firewall-cmd --permanent --zone=public --add-service=https 
firewall-cmd --reload

Done. Now you can put your website files under

/var/www/html/ 

For example, let’s make an index.html file

echo "Hello Manjaro.site" > /var/www/html/index.html

Open the browser and type the CentOS 8 IP address

Be the first to comment

Leave a Reply