Hello Friends .
i have install apache in my RHEL5.6 .
# yum install httpd
After installing Apache i run the httpd service by.
# yum restart httpd
than i check the default page in Firefox and elinks it worked properly.
than i put a simple website index.html in the default document root /var/www/html/. restart the httpd service and it worked fine in the bowsers.
i tried to configure a name based virtualhost here is the configuration .
Code:
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
<VirtualHost sports.com:80>
ServerAdmin admin@sports.com
DocumentRoot /var/www/vhosts/sports.com/html/
ServerName sports.com
ErrorLog /var/www/vhosts/sports.com/log/error_log
CustomLog /var/www/vhosts/sports.com/log/access_log common
</VirtualHost>
I put another index.html file in the /var/www/vhosts/sports.com/html/ directory.
After making this configuration i restarted the httpd service again.
Now the problem is here.
Now when i test these configuration in the browser , I typed localhost in the browser now the index.html of the localhost machine is not showing now. The index.html page of sports.com is coming instead of localhost's index.com .
## I have added the sports.com in the /etc/hosts/ file in the line of 127.0.0.1 after localhost
127.0.0.1 localhost localhost.localdomain sports.com
####
Now where is the problem ... Kindly help me in this.
Thanks and regards
Md Reza