This guide explains how to configure a basic Apache web server on Red Hat Enterprise Linux 7. This is also on of the objectives on the RHCSA 7 exam and a fundamental skill required for the RHCE 7 exam.
1 ) The first thing that you will need to do is install the httpd service if it is not already installed. Below are a few options for accomplishing this.
Also this guide assumes all commands are entered as the “root” user.
yum -y groupinstall “Basic Web Server”
yum -y install httpd httpd-manual
Note: The package httpd-manual has the apache documentation which may be helpful with configuration.
2) Enable the httpd service with the following command. This will cause the service to start when the system is booted.
systemctl enable httpd.service
3) Open the firewall to allow access to the web server.
firewall-cmd --add-service=http --permanent --zone=public
Note: the –add-service statement is “http” and NOT “httpd”
4) Reload the configuration changes to the firewall
systemctl reload firewalld.service
5) Start the httpd service
systemctl start httpd.service
6) You can test the functionality by opening a browser for a computer on the same network and entering the IP in the address field. You will see the apache test page if successful.
The default directory for the Apache server is “/var/www/html/”