How to Install and Configure Apache Web Server on RHEL 8

Installation and Configuration of Apache Web Server on RHEL 9/RHEL 8/RHEL 7/CentOS 8/CentOS 7

Web server is a software that uses hypertext transfer protocol (http) have plain text data and secure hypertext transfer protocol (https) to provide secure data with secure socket layer (SSL) or Transport layer security (TLS) as per the client request through web browser on machine. Hypertext transfer protocol (http) default port is 80 and secure hypertext transfer protocol (https) default port is 443. With Hypertext transfer protocol (http) and secure hypertext transfer protocol (https) any port can be used that is specific application port. The fundamental purpose of a web server is to provide a website content to the user that is store on a specific location on a web server. Web server also support File transfer Protocol “FTP” by use of this protocol client can easily access their documents and files in any format, due to security reason File transfer Protocol “FTP” is not use in most organization because File transfer Protocol “FTP” data in plain text even login id and password can be readable through a Network. The port use in File transfer Protocol “FTP” is 21/tcp for control and command and use port 20/tcp for data.
Web Server deliver a content of website by use of IP address on multiple ports or use names specially on domain environment otherwise on name base website you need to add a host entry on each host where you want to access the name base website. Actually, in Domain environment only add host entry with the IP on DNS server so end users can easily access a name base website from domain base environment in client machines. In web server, the term dynamic web browser is use for application with database. In this scenario application server request a content from database that is much flexible but complicated.

Apache Web Server:

Apache web server is a free open source web server that is develop by apache software foundation in 1995. In Linux operating system apache is comparatively more useful then nginx and tomcat. Apache web server is compatible with Linux, Windows and UNIX. Apache web server easily customize and provide secure communication between server to client machines. Apache web server is a module base structure and due to its open source it’s security patches updated easily. Mostly in Linux base operating system Apache is use with database (Microsoft SQL and Mysql) and programming language (PHP). Due to it’s open source functionality apache web server is much familiar in developer community. The main disadvantage of apache web server it is not support large number of concurrent connections, by default apache web server support 150 concurrent connections and it can be change into 8000 concurrent connections means 8000 users access apache base webserver on the same time but on the other side more familiar web server nginx is available on Linux base operating system that support 100 thousand concurrent connections at the same time. But as per the requirement if apache web server fulfill the organization need then use apache web server as compare to nginx server due to it’s flexibility and wide range of modules.

To install apache web server on Redhat 8/CentOS 8, type the below mention command. You can also use command “yum” for the installation of package.

dnf -y install httpd

how to install and configure apache web server on redhat 7

The apache package “httpd” with all dependencies has been successfully installed on the Redhat Enterprise Linux 8 (RHEL 8) as shown in below image.

how to install and configure apache web server on redhat 7

To start, enable and check the status apache web server service “httpd”, type the below mention command.

systemctl start httpd
systemctl enable httpd
systemctl status httpd

how to install and configure apache web server on redhat 9

If firewall “firewalld” is enable on Redhat Enterprise Linux 8 (RHEL 8) therefore need to be allow firewall on port 80 and 443 of TCP (Transmission Control Protocol), type the below mention command to allow access and after that must reload the firewall “firewalld”.

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

how to install and configure apache web server on redhat 9

To verify the apache web server is working fine or not after allow firewall rules, type the below mention URL (Uniform Resource Locator).

http://10.0.1.8

how to install and configure apache web server on linux

For testing purpose if you want to create your own page that should be the default index.html page, for this scenario rename or delete welcome page of Apache web server on RHEL 9/RHEL 8/RHEL 7/CentOS 7/CentOS 8. Here we rename the welcome page by use of command “mv”.

mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.org

how to install and configure apache web server on linux

httpd.conf settings:

Modify the apache web server configuration file “/etc/httpd/conf/httpd.conf” as per your own environment by use of editor “vi”.

vi /etc/httpd/conf/httpd.conf
how to install and configure apache web server on redhat 8

Provide the Server Admin email address on line number 91. The Server Admin email address show on web pages when error is occur on a web browser on client machine, so user can easily send an email to Server Admin email address to report issues.

ServerAdmin owais@abc.org.pk

how to install apache web server on rhel 8

Uncomment the line number 100 and specify a server name of apache web server, in our case the web server name is “apache1.abc.org.pk”.

ServerName apache1.abc.org.pk:80

how to install and configure apache web server on rhel 8

On line number 148 remove indexes on “Options Indexes FollowSymLinks”, after remove “indexes” the line will be “Options FollowSymLinks”.

how to install apache web server on rhel 7

On Line number 155 replace “None” to “All”, before modify the line is “AllowOverride None” then after modify the line will “AllowOverride All”.

how to install and configure apache web server on rhel 7

On Line number 168 provide the Directory index pages name that will use as a default page as per the configuration of web server.

DirectoryIndex index.html index.php index.cgi

how to install apache web server on rhel 9

At the end of apache web server configuration file “/etc/httpd/conf/httpd.conf” provide server response header.

# Server response headers
ServerTokens Prod

how to install and configure apache on rhel 8

Create a Page:

Create a HTML test page then check it on a web browser on any client machine that is available on a network. Here we create a page “index.html” on default directory “html” of apache web server by use of editor “vi”.

vi /var/www/html/index.html

how to install and configure apache on rhel 7

Edit the below mention code in file "index.html".

<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Pakistan
</div>
</body>
</html>

how to install and configure apache on rhel 9

To check the page is working fine or not, type the below mention URL “Uniform Resource Locator” on a web browser on client machine that should be available on a network.

http://10.0.1.8

how to install and configure apache on redhat 8

To access a web server by use of name in a domain environment add host entry on DNS Server. Here we add a host entry “apache1” against IP “10.0.1.8” on DNS (Domain Name Server).

how to install and configure apache on redhat 7

To access an apache web server by use of Full qualified domain name, type the below mention URL as per you environment.

http://apache1.abc.org.pk

how to install and configure apache on redhat 9
Thanks for Read This Article

Comments