Tuesday, 11 September 2012

How to install and configure Apache web server in linux step by step guide and implementation


Apache web sever is the leading open source internet web server. Several key factors have contributed to Apache’s success:
  • The Apache license. It is an open sourceBSD−like license that allows for both commercial and non−commercial uses of Apache.
  • Talented community of developers with a variety of backgrounds and an open development process based on technical merits.
  • Modular architecture. Apache users can easily add functionality or tailor Apache to their specific enviroment.
  • Portable: Apache runs on nearly all flavors of Unix (and Linux), Windows, BeOs, mainframes
  • Robustness and security.
Many commercial vendors have adopted Apache−based solutions for their products, including Oracle, Red Hat and IBM. In addition, Covalent provides add−on modules and 24×7 support for Apache.
How to setup a Apache webserver
This article guides you how to set up a apache web server in Linux operating system (redhat, fedora distributions). Open terminal in root user mode and check whether httpd is installed. If it is already installed leave it, else installs it from the repository using yum. In case you don’t have yum configuration, configure it. After configuration of the yum follow the below procedure.
To Check whether httpd is installed
# rpm –qa | grep httpd
To install httpd
#yum install httpd
After installation of the httpd package , open its configuration file which is located at/etc/httpd/http.conf . Before editing the configuration file make a backup of the file and save it in an another directory.
Now open the file by using vi editor ( you can use any other type of editors )
#vi /etc/httpd/http.conf
Use :set number command to set the line number to the file. It increases the readability of the file.
search the line which contains “ Listen 80 ” and change it to “ Listen “your system ip address “ :80 “ after that save and quit the file by using Esc + :wq command.
Now restart the httpd service by using the following command. It restarts the service temporarily upto system is turned on
#service httpd restart.
If you want to turn on the service always, use the chkconfig configure apache to start at boot
# chkconfig httpd on
Use the httpd init script in the /etc/init.d directory to start/stop/restart apache after booting
# /etc/init.d/httpd  start
#/etc/init.d/httpd  stop
#/etc/init.d/httpd  restart
You can also test whether the Apache process is running with the following command; you should get a response of plain old process ID numbers
# pgrep httpd
Open the firewall and enable the http services. To open firewall use setup command
# setup
Now point out the browser to http://domainname or else http://ipaddress
In the browser a test page will be displayed like the below figure.
In case if the message is not displayed once again check the firewall and SE linux ( services )
Restart  the network service
# service network restart
#chkconfig network on
Restart httpd service
# service httpd restart
#chkconfig httpd on
The public directory is located at /var/www
Create a test html file and check it whether it is working or not
# vi /var/www/test.html &
test.html
<html>
<head>
<title>  HTTP web server </title>
</head>
<body>
<h1>  The web server is running successfully </h1>
</body>
</html>
open a browser and point out to http://ipaddress/test.html

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes