web server installation and configuration step by step guide

Apache web server installation and configuration step by step guide in RHEL7 and Centos 7.

web server is used to host websites using httpd service.

Why Apache name chosen for this software..?

This software is chosen a name called APACHE because its firstly group of patches included and used as a software to run we server from native American nations group. Native American people called as Apache men. As shown in figure below he is an Apache men from native American group of people. 

why apache name chosen

Now if you observe carefully above picture he is wearing an CAP with below shown picture that’s where Apache name is confirmed for this software

web server

Prerequisites

  1. Create DNS entry to resolve you web server name
  2. Web browser to access the web server

Server profile

Package Name: httpd*

Daemon Name: httpd

Config File: /etc/httpd/conf/httpd.conf

/etc/httpd/conf.d/ANYNAME.conf

Port Numbers: 80  (HTTP) and 443 (HTTPS)

Web server installation process

[root@ArkIT ~]# yum install httpd*
Transaction Summary
===============================================================================================================================================================================================================
Install 4 Packages (+9 Dependent packages)

Total download size: 4.4 M
Installed size: 16 M
Is this ok [y/d/N]: y
Downloading packages:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 30 MB/s | 4.4 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : apr-1.4.8-3.el7.x86_64 1/13
 Installing : apr-util-1.5.2-6.el7.x86_64 2/13
 Installing : apr-devel-1.4.8-3.el7.x86_64 3/13
 Installing : httpd-tools-2.4.6-31.el7.x86_64 4/13
 Installing : cyrus-sasl-devel-2.1.26-17.el7.x86_64 5/13
 Installing : openldap-devel-2.4.39-6.el7.x86_64 6/13
 Installing : libdb-devel-5.3.21-17.el7_0.1.x86_64 7/13
 Installing : expat-devel-2.1.0-8.el7.x86_64 8/13
 Installing : apr-util-devel-1.5.2-6.el7.x86_64 9/13
 Installing : mailcap-2.1.41-2.el7.noarch 10/13
 Installing : httpd-2.4.6-31.el7.x86_64 11/13
 Installing : httpd-devel-2.4.6-31.el7.x86_64 12/13
 Installing : httpd-manual-2.4.6-31.el7.noarch 13/13
 Verifying : openldap-devel-2.4.39-6.el7.x86_64 1/13
 Verifying : apr-1.4.8-3.el7.x86_64 2/13
 Verifying : mailcap-2.1.41-2.el7.noarch 3/13
 Verifying : httpd-2.4.6-31.el7.x86_64 4/13
 Verifying : apr-devel-1.4.8-3.el7.x86_64 5/13
 Verifying : apr-util-1.5.2-6.el7.x86_64 6/13
 Verifying : expat-devel-2.1.0-8.el7.x86_64 7/13
 Verifying : httpd-tools-2.4.6-31.el7.x86_64 8/13
 Verifying : libdb-devel-5.3.21-17.el7_0.1.x86_64 9/13
 Verifying : cyrus-sasl-devel-2.1.26-17.el7.x86_64 10/13
 Verifying : httpd-devel-2.4.6-31.el7.x86_64 11/13
 Verifying : apr-util-devel-1.5.2-6.el7.x86_64 12/13
 Verifying : httpd-manual-2.4.6-31.el7.noarch 13/13

Installed:
 httpd.x86_64 0:2.4.6-31.el7 httpd-devel.x86_64 0:2.4.6-31.el7 httpd-manual.noarch 0:2.4.6-31.el7 httpd-tools.x86_64 0:2.4.6-31.el7

Dependency Installed:
 apr.x86_64 0:1.4.8-3.el7 apr-devel.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 apr-util-devel.x86_64 0:1.5.2-6.el7 cyrus-sasl-devel.x86_64 0:2.1.26-17.el7
 expat-devel.x86_64 0:2.1.0-8.el7 libdb-devel.x86_64 0:5.3.21-17.el7_0.1 mailcap.noarch 0:2.1.41-2.el7 openldap-devel.x86_64 0:2.4.39-6.el7

Complete!

required to install httpd and its dependencies

Enable and Start the Service

[root@ArkIT ~]# systemctl enable httpd.service
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[root@ArkIT ~]# systemctl start httpd.service
[root@ArkIT ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
 Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
 Active: active (running) since Sun 2016-05-15 21:13:29 IST; 11s ago

service enable – which means whenever you restart server, service should automatically enable

service start Normally starting service

As per the above commands web server is installed and started

Allow firewall ports to communicate with clients

[root@ArkIT ~]# firewall-cmd --permanent --add-service=http
success
[root@ArkIT ~]# firewall-cmd --permanent --add-service=https
success
[root@ArkIT ~]# firewall-cmd --reload
success

web server ports are 80 and 143 default for HTTP and HTTPS

in RHEL 7 and Centos 7 version instead of port numbers we can directly mention the service which will automatically take its related default port

if you would like to mention the port use below commands

[root@ArkIT ~]# firewall-cmd --permanent --add-port=80/tcp
success
[root@ArkIT ~]# firewall-cmd --permanent --add-port=80/udp
success
[root@ArkIT ~]# firewall-cmd --permanent --add-port=443/tcp
success
[root@ArkIT ~]# firewall-cmd --permanent --add-port=443/udp
success
[root@ArkIT ~]# firewall-cmd --reload
success

Configuring the web server

create a file with any name extension should be .conf under /etc/httpd/conf.d/*.conf

in this case  I am going to use main.conf is the configuration file

apache web server

[root@ArkIT ~]# cat /etc/httpd/conf.d/main.conf
<VirtualHost *:80>
 ServerAdmin root@arkit.co.in
 ServerName server1.arkit.co.in
 DocumentRoot /var/www/html/
</VirtualHost>
<Directory "/var/www/html/">
 AllowOverride none
 Require all granted
</Directory>
[root@ArkIT ~]# vim /etc/httpd/conf.d/main.conf
[root@ArkIT ~]# systemctl restart httpd.service
[root@ArkIT ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
 Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
 Active: active (running) since Sun 2016-05-15 21:43:00 IST; 8s ago

Check configuration if you run with any problems

[root@ArkIT ~]# apachectl configtest
Syntax OK

Create HTML file for test

Go to path /var/www/html/ and create index.html file and write some HTML code or some text test your website

[root@ArkIT ~]# vim /var/www/html/index.html
[root@ArkIT ~]# cat /var/www/html/index.html
Web Server Test File

Client side

Web server testing, as you created above test file with some text in it. Now go to client machine and type server IP / Name to test your web server is working or not

web server test

That’s it about Apache / HTTP service installation and configuration.

Please provide your valuable feedback on the same

web server installation and configuration

Securing WebServer by adding SSL certificate

Creating Secret Website Installation and configuration Guide

Thanks for your wonderful Support and Encouragement

Stay Connected with us. Learn More and Earn More

ARK

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

You may also like...

4 Responses

  1. testme says:

    https port is 443 not 143…

Leave a Reply