web server installation and configuration step by step

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.

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

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

systemctl enable httpd.service
ln -s ‘/usr/lib/systemd/system/httpd.service’ ‘/etc/systemd/system/multi-user.target.wants/httpd.service’
systemctl start httpd.service
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

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

cat /etc/httpd/conf.d/main.conf
<VirtualHost *:80>
 ServerAdmin root@kosecurity.in
 ServerName server1.kosecurity.in
 DocumentRoot /var/www/html/
</VirtualHost>
<Directory "/var/www/html/">
 AllowOverride none
 Require all granted
</Directory>

vim /etc/httpd/conf.d/main.conf
systemctl restart httpd.service
systemctl status httpd.service

httpd.service - The Apache HTTP Server
 Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
 Active: active (running) since Sun 2017-06-13 21:43:00 IST; 8s ago
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

vim /var/www/html/index.html
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
http://10.59.60.180


	

Be the first to comment

Leave a Reply

Your email address will not be published.


*