Tuesday 3 August 2021

How to Install and Configure HTTPD Web Server on RedHat8.1 Linux


This tutorial will guide you on step by step installation and configuration of HTTPD WEB Server on RedHat 8.1 Linux server.

1. Install HTTPD

Open terminal and login through root user then execute yum command to install httpd.

[root@worldwidelinux ]# yum -y install httpd

The above command will install all the dependency packages related to httpd web server.

2. Configure HTTPD

Below are the changes need to be done on httpd configuration file for creating your own web server.

Step:1 Set email address for your web server

ServerAdmin - where problems with the server should be e-mailed

Open http configuration file using vim editor and change on line :39

Edit and change from ServerAdmin root@localhost to ServerAdmin root@worldwide.linux

Step:2 Set domain name or ip address for your web server

ServerName - Name and port that the server uses to identify itself.

You can assign your system ip address as a server name or if you have a own domain, can configure here. For example, we gonna configure our local IP address as server name.

Uncomment a line :98 and change from #ServerName www.example.com:80 to ServerName 192.168.107:80

Step:3 Remove Indexes

Edit on line :147 and change from Options Indexes FollowSymLinks to Options FollowSymLinks

Step:4 AllowOverride Controls

Edit on line :154 and change from AllowOverride None to AllowOverride All

Step:5 Add Directory index file name with php extension to serve if a directory is requested

Add index.php next to index.html on line :167

It should looks like given below:

DirectoryIndex index.html index.php

Step:6 Add server's response header

Add a below line at the end of httpd.conf file.

ServerTokens Prod

3. Enable HTTPD Service

Execute a below command to enable a httpd service:

[root@worldwidelinux ]# systemctl enable --now httpd

For more information on service start, stop, enable or disbale services, please check here.

4. If FireWall is running, allow HTTPD Service


[root@worldwidelinux ~]# firewall-cmd --add-service=http --permanent

success

[root@worldwidelinux ~]# firewall-cmd --reload

success


5. Start HTTPD Service

[root@worldwidelinux ]# systemctl start httpd.service

6. Create a HTML test page

Create a file called index.html under /var/www/html/ directory.

[root@worldwidelinux ]# vim /var/www/html/index.html

7. Access html file from firefox browser

We configured 192.168.0.107 ip address as web server address, so open firefox browser and type https://192.168.0.107 then press Enter key.

That's it, you have own web server now. Enjoy creating websites and web applications through httpd web server. I hope this tutorial is very helpful to create a HTTPD Web Server on RedHat 8.1 Linux Server.