You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Madere, Colin" <co...@ieminc.com> on 2003/01/28 23:29:36 UTC

[users@httpd] IP-based vhosts and domain names problem

Setup:

httpd.conf
***
ServerName server.my.domain
Listen IP1:80

<VirtualHost IP1:80>
DocumentRoot "/www/one"
ServerName server.my.domain
...
</VirtualHost>

Listen IP2:443
Listen IP3:443

<VirtualHost IP2:443>
DocumentRoot "/www/one/two"
ServerName server2.my.domain
...
</VirtualHost>

<VirtualHost IP2:443>
DocumentRoot "/www/one/two/three"
ServerName server3.my.domain
...
</VirtualHost>

Problem:
  When using IPs to browse to servers, all works fine.  When using names to
browse, requests to all domain names serve up content from the default/first
site (or vhost #1) on port 80.  With log files set up for each different
vhost, the hit gets recorded in that vhosts log file, but the content is
pulled from the DocumentRoot of the site on port 80 (vhost #1).  As I said
above, when IPs are used the appropriate content gets served.

Notes:
  Tomcat and JK are used to fwd app requests, but that seems unrelated and
Tomcat is reacting correctly when requests are forwarded.  As I said, it
works fine with just IPs, but when names are added Apache always acts as
though content were requested of vhost #1.

Ideas?

Colin Madere


---------------------------------------------------------------------
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] IP-based vhosts and domain names problem

Posted by Amol Jakatdar <aj...@odu.edu>.
FYI,

Name based virtual hosts DO NOT work with SSL.
With SSL the first VirtualHost for that IP will always be selected.
http://httpd.apache.org/docs-2.0/vhosts/name-based.html

Madere, Colin wrote:
> Setup:
> 
> httpd.conf
> ***
> ServerName server.my.domain
> Listen IP1:80
> 
> <VirtualHost IP1:80>
> DocumentRoot "/www/one"
> ServerName server.my.domain
> ...
> </VirtualHost>
> 
> Listen IP2:443
> Listen IP3:443
> 
> <VirtualHost IP2:443>
> DocumentRoot "/www/one/two"
> ServerName server2.my.domain
> ...
> </VirtualHost>
> 
> <VirtualHost IP2:443>
> DocumentRoot "/www/one/two/three"
> ServerName server3.my.domain
> ...
> </VirtualHost>
> 
> Problem:
>   When using IPs to browse to servers, all works fine.  When using names to
> browse, requests to all domain names serve up content from the default/first
> site (or vhost #1) on port 80.  With log files set up for each different
> vhost, the hit gets recorded in that vhosts log file, but the content is
> pulled from the DocumentRoot of the site on port 80 (vhost #1).  As I said
> above, when IPs are used the appropriate content gets served.
> 
> Notes:
>   Tomcat and JK are used to fwd app requests, but that seems unrelated and
> Tomcat is reacting correctly when requests are forwarded.  As I said, it
> works fine with just IPs, but when names are added Apache always acts as
> though content were requested of vhost #1.
> 
> Ideas?
> 
> Colin Madere
> 
> 
> ---------------------------------------------------------------------
> 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] IP-based vhosts and domain names problem

Posted by Josh Wyatt <Jo...@hcssystems.com>.
Madere, Colin wrote:

> Listen IP2:443
> Listen IP3:443
> 
> <VirtualHost IP2:443>
> DocumentRoot "/www/one/two"
> ServerName server2.my.domain
> ...
> </VirtualHost>
> 
> <VirtualHost IP2:443>
> DocumentRoot "/www/one/two/three"
> ServerName server3.my.domain
> ...
> </VirtualHost>


It looks like you are trying to do name-based virtual hosting (both 
VirtualHost entries are for IP2, in your example above) for SSL sites 
(port 443).

This is not possible due to the nature of SSL:
http://httpd.apache.org/docs/vhosts/name-based.html

Thanks,
Josh



---------------------------------------------------------------------
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] IP-based vhosts and domain names problem

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, 28 Jan 2003, Madere, Colin wrote:
> Problem:
>   When using IPs to browse to servers, all works fine.  When using names to
> browse, requests to all domain names serve up content from the default/first
> site (or vhost #1) on port 80.  With log files set up for each different
> vhost, the hit gets recorded in that vhosts log file, but the content is
> pulled from the DocumentRoot of the site on port 80 (vhost #1).  As I said
> above, when IPs are used the appropriate content gets served.

You've so thouroughly obscured your config that it is very difficult to
tell what is going on.  The first things I would check are:

1. Is the DNS mapping really correct?

2. Are you running any "funny" third-party modules, like mod_dyn_vhost for
example?

Other than that, please post the unobscured vhost configuration (real
names and IP addresses) so we can check it more easily.

Joshua.

---------------------------------------------------------------------
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