LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apache: Virtualhost configuration problem (https://www.linuxquestions.org/questions/linux-software-2/apache-virtualhost-configuration-problem-81282/)

deepika 08-12-2003 09:48 AM

Apache: Virtualhost configuration problem
 
Hi all,

I have installed Apache on my RH8.0 with below packages.

httpd
httpd-manual
mod_ssl
mod_perl
mod_python

The installation seemed to work fine as I could see the test page.
Now I want to configure it for name-based Virtual hosting and have changed my /etc/htpd/conf/httpd.conf as below .
-----------------------------------------------------------------------------------
.
.
ServerName deepika.mydomain.com:80
.
.
DocumentRoot "/var/www/html"
.
.
# Use name-based virtual hosting.
#
#NameVirtualHost *
NameVirtualHost 192.168.0.2

#
# 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 192.168.0.2>
DocumentRoot /var/www/html/docs/pawan.domain.com
ServerName pawan.domain.com
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>


<VirtualHost 192.168.0.2>
DocumentRoot /var/www/html/docs/deepika.mydomain.com
ServerName deepika.mydomain.com
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>

<VirtualHost 192.168.0.2>
DocumentRoot /var/www/html/docs/pawan.mydomain.com
ServerName pawan.mydomain.com
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>

<VirtualHost 192.168.0.2>
DocumentRoot /var/www/html/docs/www.redhat.com
ServerName www.redhat.com
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>

<VirtualHost 192.168.0.2>
DocumentRoot /var/www/html/docs/www.hotmail.com
ServerName www.hotmail.com
DirectoryIndex index.php index.html index.htm index.shtml
</VirtualHost>

------------------------------------------------------------------------------------

Now when I use http://pawan.domain.com or http://deepika.mydomain.com or http://pawan.mydomain.com it works fine as it takes me to either test page or my own pages as expected but when I ues http://www.redhat.com or http://www.hotmail.com it takes me to internet site even when I have configured these in my /etc/hosts as below(where my eth1 = 192.168.0.2)

127.0.0.1 localhost.localdomain localhost
192.168.0.1 local0
192.168.1.2 local1
192.168.0.2 pawan.domain.com
192.168.0.2 pawan.mydomain.com
192.168.0.2 deepika.mydomain.com
#192.168.0.2 www.yahoo.com
192.168.0.2 www.redhat.com
192.168.0.2 www.hotmail.com

And the order defined in /etc/host.conf file is order hosts,bind

I don't understand why doesn't it uses the configuration from my /etc/hosts and httpd.conf file for www.redhat.com and www.hotmail.com.

Can anyone please help me in identifying the problem. Any help will be greatly appreciated.

Thanks & regards,
Deepika

:newbie:

Azmeen 08-12-2003 09:54 AM

Ping www.redhat.com or www.hotmail.com and see what IP it resolves to...

If it does resolve to 192.168.0.2, then most probably u have a stale cache in your browser.

deepika 08-12-2003 10:08 AM

yes, it resolves to 192.168.0.2 but I tried reloading these links again and again and it still gives me the same results. How do I make the browser use my configuration for these links??

Azmeen 08-12-2003 10:13 AM

If using most X-based browser, pressing on the Ctrl button while clicking on the Refresh button will do.

Have you tried opening those URLs in lynx or any other text-based browsers?


All times are GMT -5. The time now is 05:46 AM.