You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Robert Moskowitz <rg...@htt-consult.com> on 2003/07/08 16:00:13 UTC

Re: [users@httpd] Virtual host causing problems with default server

At 03:47 PM 7/8/2003 +0200, Patrick Donker wrote:
>read http://httpd.apache.org/docs-2.0/vhosts/

I have.  Many times.

I can't figure out what I am missing.  And I think I must be missing 
something from my Main Server section to cause a URL NOT to the virtual 
host to still go to the virtual host.


>Robert Moskowitz wrote:
>
>>My 2.0.44 server is running on NT.
>>
>>When I add the lines:
>>
>><VirtualHost abc.org>
>>     ServerAdmin abc@abc.org
>>     DocumentRoot "D:/Pages-abc"
>>     ServerName abc.org:80
>>     ErrorLog logs/abc.org-error.log
>>     CustomLog logs/abc.org-access.log common
>></VirtualHost>
>>
>>Access to my default server get redirected to the virtual host  :(
>>
>>Section 2 of my conf does have:
>>
>>ServerName host.xyz.com:80
>>DocumentRoot "D:/Pages"
>>
>>What am I missing???
>>
>>
>>Illegitimi non Carborundum
>>
>>
>>---------------------------------------------------------------------
>>The official User-To-User support forum of the Apache HTTP Server Project.
>>See <URL:http://httpd.apache.org/userslist.html> for more info.
>>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>>For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual host causing problems with default server

Posted by Robert Moskowitz <rg...@htt-consult.com>.
At 03:45 PM 7/10/2003 +0200, Robert Andersson wrote:

>Is home.com defined as a virtual host? If that is your "main server" and it
>isn't sitting on a different IP than your virtual hosts, you won't ever
>reach, due to reasons previously explained. If you are using name-based
>virtual hosting, you must define each site/domain as a virtual host. With a
>few exceptions, once you start adding virtual hosts, your "main
>configuration" only becomes the default configuration for the virtual hosts;
>not a host of its own.
>
>If you still have problems, please summarize your case again, since this has
>become a bit confusing.

Boy, was I confusicated by the docs that I read.  Thanks to a doc sent to 
me by Patrick Donker, I figured out all I was doing wrong....

Both the NameVirtualHost and the <VirtualHost _____> are suppose to have IP 
addresses for the server, and only FQDNs if you want to use DNS at startup 
to resolve names to addresses.  Dah.

What distinguishes multiple <VirtualHost _______> blocks is the content of 
the ServerName entry.  This was not clear from the main VirtualHost doc 
page, their it seemed like you needed separate IP addresses for each 
virtual host (which was once the case).

So it is working now.  I have my NameVirtualHost entry and 3 <VirtualHost 
_____> blocks.

thanks all!


The only person who always got his work done by Friday was Robinson Crusoe.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual host causing problems with default server

Posted by Robert Andersson <ro...@profundis.nu>.
Robert Moskowitz wrote:
> I originally did not use the command:
>
> NameVirtualHost
>
> I added it both trying:
>
> NameVirtualHost www.home.com
>
> and
>
> NameVirtualHost home.com
>
> with no change.

Does www.home.com and home.com resolve to different IPs? If not, why do you
have them both? NameVirtualHost tells Apache which IP/port combinations to
use for name-based virtual hosting. It is always prefered to use the IP
instead of hostname:
http://httpd.apache.org/docs-2.0/mod/core.html#namevirtualhost

> I tried adding:
>
> <VirtualHost home.com>
>      ServerAdmin abc@home.com
>      DocumentRoot "D:/Pages"
>      ServerName abc.org:80
>      ErrorLog logs/error.log
>      CustomLog logs/access.log common
> </VirtualHost>
>
> And this produced some error that flashed too quick across the screen, but
> something like
>
> 'this conflicts with the default server'

If this was in addition to the other VHost, the problem is that you have
given two VHosts the same ServerName, which, of course, is conflicting.

> and still no access to home.com

Is home.com defined as a virtual host? If that is your "main server" and it
isn't sitting on a different IP than your virtual hosts, you won't ever
reach, due to reasons previously explained. If you are using name-based
virtual hosting, you must define each site/domain as a virtual host. With a
few exceptions, once you start adding virtual hosts, your "main
configuration" only becomes the default configuration for the virtual hosts;
not a host of its own.

If you still have problems, please summarize your case again, since this has
become a bit confusing.

Regards,
Robert Andersson




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual host causing problems with default server

Posted by Robert Moskowitz <rg...@htt-consult.com>.
At 06:52 AM 7/9/2003 +0200, Robert Andersson wrote:
>Aaron Morris wrote:
> > While this may be true for Name based VirtualHosts (it makes sense, I
> > just never had a problem with it :) ), the same cannot be said for IP or
> > port based VirtualHosts.  If a VirtualHost is not matched in an IP based
> > setup, then the global server config is used.
>
>True, my mistake. Thanks for pointing it out. I had forgotten that
>difference, although it makes perfect sense, and assumed that the OP was
>utilizing name-based virtual hosts (which I dare guess still is true).

As I showed in my message I have:

<VirtualHost abc.org>
     ServerAdmin abc@abc.org
     DocumentRoot "D:/Pages-abc"
     ServerName abc.org:80
     ErrorLog logs/abc.org-error.log
     CustomLog logs/abc.org-access.log common
</VirtualHost>

I originally did not use the command:

NameVirtualHost

I added it both trying:

NameVirtualHost www.home.com

and

NameVirtualHost home.com

with no change.

I tried adding:

<VirtualHost home.com>
     ServerAdmin abc@home.com
     DocumentRoot "D:/Pages"
     ServerName abc.org:80
     ErrorLog logs/error.log
     CustomLog logs/access.log common
</VirtualHost>

And this produced some error that flashed too quick across the screen, but 
something like

'this conflicts with the default server'

and still no access to home.com

If I take out the virtualhost section, the default server works, so I know 
that is the problem...



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual host causing problems with default server

Posted by Robert Andersson <ro...@profundis.nu>.
Aaron Morris wrote:
> While this may be true for Name based VirtualHosts (it makes sense, I
> just never had a problem with it :) ), the same cannot be said for IP or
> port based VirtualHosts.  If a VirtualHost is not matched in an IP based
> setup, then the global server config is used.

True, my mistake. Thanks for pointing it out. I had forgotten that
difference, although it makes perfect sense, and assumed that the OP was
utilizing name-based virtual hosts (which I dare guess still is true).

Regards,
Robert Andersson




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual host causing problems with default server

Posted by Aaron Morris <aa...@mindspring.com>.
Robert Andersson wrote:

> What you may be missing, is that as soon as you define a virtual host, your
> "main server" cease to exist. You cannot have both a "main server" and one
> or more virtual hosts; the modes are mutally exclusive. In fact, the first
> defined virtual host becomes the default/main server for requests that can't
> be matched to another virtual host.

While this may be true for Name based VirtualHosts (it makes sense, I 
just never had a problem with it :) ), the same cannot be said for IP or 
port based VirtualHosts.  If a VirtualHost is not matched in an IP based 
setup, then the global server config is used.

-- 
Aaron W Morris <aa...@mindspring.com> (decep)
PGP Key ID:  259978D1



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Virtual host causing problems with default server

Posted by Robert Andersson <ro...@profundis.nu>.
Robert Moskowitz wrote:
> I can't figure out what I am missing.  And I think I must be missing
> something from my Main Server section to cause a URL NOT to the
> virtual host to still go to the virtual host.

What you may be missing, is that as soon as you define a virtual host, your
"main server" cease to exist. You cannot have both a "main server" and one
or more virtual hosts; the modes are mutally exclusive. In fact, the first
defined virtual host becomes the default/main server for requests that can't
be matched to another virtual host.


Regards,
Robert Andersson




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org