How to configure Apache Server (http) in CentOS 7, Redhat 7, Fedora. - Linux tech Solutions

Share on :

How to configure Apache Server (http) in CentOS 7, Redhat 7, Fedora

Http/Apache is used to host a single website or multiple website on system with static IP address.The Apache HTTP Server, is free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.

The Apache HTTP Server is cross-platform; as of 1 June 2017 92% of Apache HTTPS Server copies run on Linux distributions. Version 2.0 improved support for non-Unix operating systems such as Windows and OS/2. Old versions of Apache were ported to run on OpenVMS and NetWare.
Package httpd

Ports :-

http - 80
https - 443

Selinux context httpd_sys_content_t

Main Configuration filfe  /etc/httpd/conf/httpd.conf

Document root   /var/www/html

Server Configuration :-

To configure Apache server we must have an static ip.

1 )first of all we will install the httpd package :-

[[email protected] ~]# yum install httpd

2 )Now we will create our own configuration file in /etc/httpd/conf.d

You can create with the configuration file with any name but the file extension must be .conf .

[[email protected] ~]# vim /etc/httpd/conf.d/web.conf

In this configuration file you have to give the following parameters:-

 3 )Now you need to go the /etc/hosts file.

[[email protected] ~]# vim /etc/hosts

#[your IP]       [your Website name]

4 )Now we will to to the document root and create a index.html file.

[[email protected] ~]# vim /var/www/html/index.html

My First Web Site

5 )Now we will start the httpd service.

[[email protected] ~]# systemctl start httpd
[[email protected] ~]# systemctl enable httpd

6 )Now Apply the Firewall rule.

[[email protected] ~]# firewall-cmd   --permanent   --add-service=http
[[email protected] ~]# firewall-cmd   --reload

7 )Now our website is ready we will open it in firefox browser

[[email protected] ~]# firefox

The Video below is a step by step guide.

Share on :

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *