Subscribe:

Ads 468x60px

Pages

Thursday, June 23, 2011

Install and Configure Apache - IP Based - Part1

Follow below steps :
To install and check if the web server is running with default test page. 
The following requirement is:
The ip address of the system is 192.168.0.110 
Site name is www.ip.com and 
Admin mail id is root@example.com and 
The apache home directory is /var/www/html.

Step1: Check if the package is installed or not
#rpm -qa | grep httpd

Step2 : Install the package if you did not get any output
#yum install httpd

Step3: Check if the package is installed or not
#rpm -qa | grep httpd



Step4: Check configuration files
#rpm -ql httpd
or
#rpm -qc httpd


Step5 : Edit the configuration file
#vim /etc/sysconfig/httpd/conf/httpd.conf
##Modify the following things ###
ServerName <IP address>:80
DocumentRoot /var/www/html

##Define the Virtual Host##
##Copy last 7 line and paste it and Modfy as shown below##
<VirtualHost <SystemIPaddress>:80>
          ServerName www.ip.com
          ServerAdmin root@example.com
          DocumentRoot /var/www/html
          DirectoryIndex index.html
          <Directory /var/www/html>
               Order allow,deny
                Allow from all
          </Directory>
          ErrorLog logs/example.com-error_log
          AccessLog logs/example.com-access_log common
</VirtualHost>


#Save and exit
:wq



Step6 : Create the index file
# cat > /var/www/html/index.html
This is my first ip based web access site.
<ctrl+c>

Step7 : Check the syntax error of configuration file
#httpd -t

Step8 : Check the syntax error of configuration file
#vim /etc/hosts
<SystemipAddress>  www.ip.com

Step9 : On the service at booting time
#chkconfig httpd on

Step10 : Check if the web server is running or not by accessing local host
#elinks www.ip.com
or
#firefox www.ip.com

0 comments:

Post a Comment