LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache VirtualHost - http://www. problem (https://www.linuxquestions.org/questions/linux-server-73/apache-virtualhost-http-www-problem-549809/)

gooddesi 04-28-2007 05:59 PM

Apache VirtualHost - http://www. problem
 
Hi all,

I have installed Apache (httpd 2.2.0) on my Fedora 5.

When i type http://www.myname.mydomain.com or http://myname.mydomain.com
URL in browser it works fines. But when I type http://www.yourname.mydomain.com in browser it is not displaying any page, while http://yourname.mydomain.com link works fine. I have same problem with http://www.ourname.mydomain.com

Can you please help me to find why “www” is only working with first entry and is not working for 2nd and 3rd virtualhost entry?

My httpd.conf file is as below.
-----------------------------------------------------------------------------
.
.
ServerName localhost:80 (also tried www.myname.mydomian.com)
.
.
DocumentRoot "/Data/html"
.
.

NameVirtualHost *:80
.
.
<VirtualHost *:80>
ServerName www.myname.mydomain.com
ServerAlias myname.mydomain.com
DocumentRoot "/Data/html/myname"
</VirtualHost>



<VirtualHost *:80>
ServerName www.yourname.mydomain.com
ServerAlias www.yourname.mydomain.com yourname.mydomain.com
DocumentRoot "/Data/html/yourname"
</VirtualHost>


<VirtualHost *:80>
ServerName www.ourname.mydomain.com
ServerAlias www.ourname.mydomain.com ourname.mydomain.com
DocumentRoot "/Data/html/ourname"
</VirtualHost>

leandean 04-29-2007 12:45 AM

Apache isn't reading the second entry. Try one alias per line.

ServerAlias 1
ServerAlias 2

billymayday 04-29-2007 01:07 AM

Why the " at the end of your DocumentRoot statements?

gooddesi 04-29-2007 10:48 AM

leandean,

I tried creating 2 alias as you said but it not working.

ServerAlias www.yourname.mydomain.com
ServerAlias yourname.mydomain.com

and billymayday " was the typo error in DocumentRoot statements.

SlackDaemon 04-29-2007 11:30 AM

Do you have all these hostnames specified in your /etc/hosts file or on a DNS server? Otherwise the browser is trying to find an actual host on the internet with that name.

try to ping each of the hostnames in turn and see if they all point to your virtual server.

gooddesi 04-29-2007 09:57 PM

I tried
# dig www.myname.yourdomain.com and found there is problem with DNS entry.

I add entry in DNS and now site is working fine.

Thank you for all your help.


All times are GMT -5. The time now is 08:30 PM.