How to Configure Apache HTTP Web server on RHEL7 / CentOS7

How to configure Apache HTTP Web server, install apache server centos7, install apache server rhel7, apache http server tutorial, apache server configuration

How to Configure Apache HTTP Web server on RHEL7 / CentOS7

This article describes you the step by step procedure to setup Apache HTTP Web server on RHEL7 / CentOS7.

Lab Server Setup:
Hostname : node1.learnitguide.net
IP Address : 192.168.2.102
Operating System : CentOS 7.2 - 64 Bit

Required Packages : httpd
Default config file: /etc/httpd/conf/httpd.conf
Default Parent Directory : /var/www/html
Default ports: 80 and 443 (SSL)
Default log files: /var/log/httpd/{access_log,error_log}

Use the following instructions to install and configure the Apache HTTP Web Server on RHEL7 / CentOS7.

1. Install the Apache Web Server Package:

Install the appropriate Apache Web server package "httpd" using yum to avoid dependencies issue. Refer this link to configure the Yum Repo Server - Configure YUM Repo Server on Linux.
[root@node1 ~]# yum -y install httpd
2. Start and enable the httpd service to start when the system boots.
[root@node1 ~]# systemctl enable httpd
[root@node1 ~]# systemctl start httpd
3. Allow httpd service on firewall for incoming connection or disable the firewall.
[root@node1 ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
[root@node1 ~]# firewall-cmd --reload
By default, port 80 is blocked. It should be enabled, because default http service will listen on port 80. so we need to change the firewall rules to enable http port or you can disable the firewall completely.
[root@node1 ~]# systemctl disable firewalld
[root@node1 ~]# systemctl stop firewalld
Once the firewall rules are set or disabled completely, Open the browser from client machine where our server is reachable and enter the URL http://node1.learnitguide.net. Replace "node1.learnitguide.net" with your server name. now you could see the test message from the web server as "Testing 123...This page is used to test the proper operation of the Apache HTTP server". If you get the test output, our web service is running properly.
[ads-post]
Note : Make an entry of web server domain name in DNS to resolve the address node1.learnitguide.net or www.learnitguide.net to the IP Address. Refer this link to Install and configure the DNS Server on RHEL7 / CentOS7 or make an entry in local hosts file. Ignore if you prefer to use the Web server IP Address 192.168.2.102 directly.

Lets create a web content.

4. Create a Web content for our website to display the Webpages.

Create a index.html under web server's default parent directory /var/www/html.
[root@node1 ~]# echo "Welcome to Homepage of Learnitguide.net Test Web server" > /var/www/html/index.html
Testing purpose, I have used the simple text content in the homepage file index.html as  "Welcome to Homepage of Learnitguide.net Test Web server", You can create your own content or host the webpage content shared by the web designers. We will explain you how to setup multiple websites on single node with different directories for each websites.

5. Testing the configuration

Execute any below commands to test the configuration files for errors.
[root@node1 ~]# apachectl configtest
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.2.102. Set the 'ServerName' directive globally to suppress this message
Syntax OK
[root@node1 ~]# httpd -T
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.2.102. Set the 'ServerName' directive globally to suppress this message
httpd (pid 4335) already running
if you get warning as above output, you can ignore or just make an entry of 'ServerName' directive in the configuration file /etc/httpd/conf/httpd.conf to suppress this warning.

Once again, open the browser from client machine and enter the URL http://node1.learnitguide.net. you could see the content which we have set now as "Welcome to Homepage of Learnitguide.net Test Web server".

Also refer other Apache related articles,
SSL Configuration to enable HTTPS Apache Web Server on Linux
Apache Virtual Host Configuration to run Multiple Websites

That's all about installation and configuration of basic Linux Apache Web server on Linux.

Thanks for reading our post. share with your friends. We appreciate your feedback, Leave your comments if any.  how to install apache web server, setting up a apache http web server, how to set up a apache http web server, how to configure apache web server in linux step by step, how to configure apache web server in centos, how to configure apache web server in ubuntu, apache web server
We have more articles to be updated soon. To not miss any updates, Follow us on social networking sites and Subscribe us on our Youtube channel. install apache server centos7, install apache server rhel7, apache installation, install apache http web server, apache http server tutorial, apache server configuration, how to configure apache, how to configure apache web server,
March 10, 2016

Post a Comment

[disqus][facebook][blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget