You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Micael Padraig Og mac Grene <ca...@harbornet.com> on 2002/02/03 17:25:08 UTC

Multiple URLs/Single IP

How can I map multiple URLs, e.g. www.aa.com and www.bb.com, which are 
pointed to a single IP address, e.g. 210.34.247.21, to multiple web 
applications, e.g. webapps/aa and webapps/bb?  Many thanks for any help.  I 
have had a solution offered with a Layer-7 Switch and a squid proxy, but I 
would prefer either Apache or Tomcat solutions by far.  I see nothing in 
the documentation or in the lists.  I know how to do this with a context 
manager for JBoss and Tomcat 3.2.4, but I am moving to SOAP as my solution 
of choice with the Struts package.  Any help would be greatly 
appreciated.  Thanks, gents and ladies.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Micael Padraig Og mac Grene <ca...@harbornet.com>.
Well, I assumed it was good, and even if not, that you were meaning good. 
So, no problem, my friend!  ;-)

At 09:14 AM 2/5/02 +1100, you wrote:
>On Tue, 2002-02-05 at 08:38, Micael Padraig Og mac Grene wrote:
> > Thank you, Bojan.  I am going to try that, and will try to figure out a
> > favor for you if it works.  My father told me to always pay back ten 
> times:
> > ten times more for a good turn, and ten times more for a bad. Micael
>
>Hope I didn't give you bad advice. The 'ten times' thingy sounds really
>scary ;-)
>
>Bojan
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Bojan Smojver <bo...@binarix.com>.
On Tue, 2002-02-05 at 08:38, Micael Padraig Og mac Grene wrote:
> Thank you, Bojan.  I am going to try that, and will try to figure out a 
> favor for you if it works.  My father told me to always pay back ten times: 
> ten times more for a good turn, and ten times more for a bad. Micael

Hope I didn't give you bad advice. The 'ten times' thingy sounds really
scary ;-)

Bojan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Micael Padraig Og mac Grene <ca...@harbornet.com>.
Thank you, Bojan.  I am going to try that, and will try to figure out a 
favor for you if it works.  My father told me to always pay back ten times: 
ten times more for a good turn, and ten times more for a bad. Micael

At 08:06 AM 2/5/02 +1100, you wrote:
>Now you have me totally confused :-( I'll tell you what I know, and if
>that helps you, good. If not, please disregard.
>
>The fact that www.aa.com and www.bb.com have the same IP address makes
>them name based virtual hosts. So, you're telling your TC 3.3.x to be
>ready to handle things for both www.aa.com and www.bb.com by creating
>virtual hosts withing it. If you have Tomcat running on the same box, it
>would usually be connected to Apache via mod_jk and listen to address
>127.0.0.1 only. So, I'm not certain how the 'one IP' address plays here
>at all...
>
>Inside each virtual host, you define applications (contexts). So, you
>can have webapps/aa for www.aa.com and webapps/bb for www.bb.com.
>
>That's at least how I run my machines.
>
>Bojan
>
>On Mon, 2002-02-04 at 18:50, Micael Padraig Og mac Grene wrote:
> > I am not trying to make www.aa.com into xx.aa.com and yy.aa.com but rather
> > trying to get www.aa.com and ww.bb.com which have the same IP address 
> to be
> > webapps/aa and webapps/bb.  Isn't the virtual hosts the first solution?  I
> > think I am beginning to see how to do this, but I don't see how virtual
> > hosts are the answer.  I must be missing something here.  I have figured
> > out how to get the different URLs into different <Host> tags, but so far
> > they all encompass the same webapps or none.  I have some further ideas on
> > how to avoid that.  We'll see tomorrow.  But, I still do not see how this
> > solves my problem, Apache notwithstanding.
> >
> > Miacel
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Bojan Smojver <bo...@binarix.com>.
Now you have me totally confused :-( I'll tell you what I know, and if
that helps you, good. If not, please disregard.

The fact that www.aa.com and www.bb.com have the same IP address makes
them name based virtual hosts. So, you're telling your TC 3.3.x to be
ready to handle things for both www.aa.com and www.bb.com by creating
virtual hosts withing it. If you have Tomcat running on the same box, it
would usually be connected to Apache via mod_jk and listen to address
127.0.0.1 only. So, I'm not certain how the 'one IP' address plays here
at all...

Inside each virtual host, you define applications (contexts). So, you
can have webapps/aa for www.aa.com and webapps/bb for www.bb.com.

That's at least how I run my machines.

Bojan

On Mon, 2002-02-04 at 18:50, Micael Padraig Og mac Grene wrote:
> I am not trying to make www.aa.com into xx.aa.com and yy.aa.com but rather 
> trying to get www.aa.com and ww.bb.com which have the same IP address to be 
> webapps/aa and webapps/bb.  Isn't the virtual hosts the first solution?  I 
> think I am beginning to see how to do this, but I don't see how virtual 
> hosts are the answer.  I must be missing something here.  I have figured 
> out how to get the different URLs into different <Host> tags, but so far 
> they all encompass the same webapps or none.  I have some further ideas on 
> how to avoid that.  We'll see tomorrow.  But, I still do not see how this 
> solves my problem, Apache notwithstanding.
> 
> Miacel


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Micael Padraig Og mac Grene <ca...@harbornet.com>.
I am not trying to make www.aa.com into xx.aa.com and yy.aa.com but rather 
trying to get www.aa.com and ww.bb.com which have the same IP address to be 
webapps/aa and webapps/bb.  Isn't the virtual hosts the first solution?  I 
think I am beginning to see how to do this, but I don't see how virtual 
hosts are the answer.  I must be missing something here.  I have figured 
out how to get the different URLs into different <Host> tags, but so far 
they all encompass the same webapps or none.  I have some further ideas on 
how to avoid that.  We'll see tomorrow.  But, I still do not see how this 
solves my problem, Apache notwithstanding.

Miacel

At 06:22 PM 2/4/02 +1100, you wrote:
>I think you should have a look into Tomcat User's guide, "Configuring Virtual
>Hosting" section, as it explains how this is done. I'm not 100% any more if
>virtual hosting has been improved in any way in the 3.2.x series over what't
>described in the manual, but I can tell you for sure that 3.3.x series has
>excellent virtual hosting support (i.e. I recommend it). The preferred way 
>is to
>have separate configuration files for different vitual hosts/applications.
>
>For instance, this file (which has to be named apps-*.xml)
>
>----------------------------------------------
><?xml version="1.0" encoding="ISO-8859-1"?>
><Server>
>   <Host name="www.somehost.domain" >
>     <Context path="/" docBase="/var/www/html/somehost.domain" />
>   </Host>
></Server>
>----------------------------------------------
>
>configures one such virual host/application pair in Tomcat 3.3.x. One can,
>obviously, configure more then one context.
>
>Your Apache configuration would have to match. For instance:
>
>----------------------------------------------
><VirtualHost 1.2.3.4:80>
>
>#  General setup for the virtual host
>DocumentRoot "/var/www/html/somehost.domain"
>ServerName www.somehost.domain
>ServerAdmin webmaster@somehost.domain
>
></VirtualHost>
>----------------------------------------------
>
>This is, of course, if you mix static files with Tomcat files (I use Velocity
>templates, which I also recommend :-) in the same directory. Otherwise, 
>they can
>be located in totally different places.
>
>Bojan
>
>Quoting Micael Padraig Og mac Grene <ca...@harbornet.com>:
>
> > Thanks, Bill.  However, I looked at the documentation.  What makes you
> >
> > think that solves this problem?  I am not saying you are wrong, but I
> > don't
> > see how that does it.
> >
> > Micael
> >
> > At 03:44 PM 2/3/02 -0800, you wrote:
> > >This is largely what NameVitualHost(s) are for in Apache.  See:
> > >http://httpd.apache.org/docs/mod/core.html#namevirtualhost
> > >----- Original Message -----
> > >From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
> > >To: <to...@jakarta.apache.org>
> > >Sent: Sunday, February 03, 2002 8:25 AM
> > >Subject: Multiple URLs/Single IP
> > >
> > >
> > > > How can I map multiple URLs, e.g. www.aa.com and www.bb.com, which
> > are
> > > > pointed to a single IP address, e.g. 210.34.247.21, to multiple
> > web
> > > > applications, e.g. webapps/aa and webapps/bb?  Many thanks for any
> > help.
> > >I
> > > > have had a solution offered with a Layer-7 Switch and a squid proxy,
> > but I
> > > > would prefer either Apache or Tomcat solutions by far.  I see
> > nothing in
> > > > the documentation or in the lists.  I know how to do this with a
> > context
> > > > manager for JBoss and Tomcat 3.2.4, but I am moving to SOAP as my
> > solution
> > > > of choice with the Struts package.  Any help would be greatly
> > > > appreciated.  Thanks, gents and ladies.
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > ><ma...@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > ><ma...@jakarta.apache.org>
> > > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > >For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Micael Padraig Og mac Grene <ca...@harbornet.com>.
I am not trying to make a number of aliases from one host but use many 
hosts to one app each for one IP.

At 11:32 PM 2/3/02 -0800, you wrote:
>The underlying VirtualHost entries can then Include the directives to the
>Tomcat instance that handles that vhost.  If you want one Tomcat, then you
>can use mod_rewrite (within the VirtualHost) to direct to the correct
>Context.
>----- Original Message -----
>From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
>To: "Tomcat Developers List" <to...@jakarta.apache.org>
>Sent: Sunday, February 03, 2002 10:09 PM
>Subject: Re: Multiple URLs/Single IP
>
>
> > Thanks, Bill.  However, I looked at the documentation.  What makes you
> > think that solves this problem?  I am not saying you are wrong, but I
>don't
> > see how that does it.
> >
> > Micael
> >
> > At 03:44 PM 2/3/02 -0800, you wrote:
> > >This is largely what NameVitualHost(s) are for in Apache.  See:
> > >http://httpd.apache.org/docs/mod/core.html#namevirtualhost
> > >----- Original Message -----
> > >From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
> > >To: <to...@jakarta.apache.org>
> > >Sent: Sunday, February 03, 2002 8:25 AM
> > >Subject: Multiple URLs/Single IP
> > >
> > >
> > > > How can I map multiple URLs, e.g. www.aa.com and www.bb.com, which are
> > > > pointed to a single IP address, e.g. 210.34.247.21, to multiple web
> > > > applications, e.g. webapps/aa and webapps/bb?  Many thanks for any
>help.
> > >I
> > > > have had a solution offered with a Layer-7 Switch and a squid proxy,
>but I
> > > > would prefer either Apache or Tomcat solutions by far.  I see nothing
>in
> > > > the documentation or in the lists.  I know how to do this with a
>context
> > > > manager for JBoss and Tomcat 3.2.4, but I am moving to SOAP as my
>solution
> > > > of choice with the Struts package.  Any help would be greatly
> > > > appreciated.  Thanks, gents and ladies.
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > ><ma...@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > ><ma...@jakarta.apache.org>
> > > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> > >For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> > For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Bojan Smojver <bo...@binarix.com>.
I think you should have a look into Tomcat User's guide, "Configuring Virtual
Hosting" section, as it explains how this is done. I'm not 100% any more if
virtual hosting has been improved in any way in the 3.2.x series over what't
described in the manual, but I can tell you for sure that 3.3.x series has
excellent virtual hosting support (i.e. I recommend it). The preferred way is to
have separate configuration files for different vitual hosts/applications.

For instance, this file (which has to be named apps-*.xml)

----------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<Server>
  <Host name="www.somehost.domain" >
    <Context path="/" docBase="/var/www/html/somehost.domain" />
  </Host>
</Server>
----------------------------------------------

configures one such virual host/application pair in Tomcat 3.3.x. One can,
obviously, configure more then one context.

Your Apache configuration would have to match. For instance:

----------------------------------------------
<VirtualHost 1.2.3.4:80>

#  General setup for the virtual host
DocumentRoot "/var/www/html/somehost.domain"
ServerName www.somehost.domain
ServerAdmin webmaster@somehost.domain

</VirtualHost>
----------------------------------------------

This is, of course, if you mix static files with Tomcat files (I use Velocity
templates, which I also recommend :-) in the same directory. Otherwise, they can
be located in totally different places.

Bojan

Quoting Micael Padraig Og mac Grene <ca...@harbornet.com>:

> Thanks, Bill.  However, I looked at the documentation.  What makes you
> 
> think that solves this problem?  I am not saying you are wrong, but I
> don't 
> see how that does it.
> 
> Micael
> 
> At 03:44 PM 2/3/02 -0800, you wrote:
> >This is largely what NameVitualHost(s) are for in Apache.  See:
> >http://httpd.apache.org/docs/mod/core.html#namevirtualhost
> >----- Original Message -----
> >From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
> >To: <to...@jakarta.apache.org>
> >Sent: Sunday, February 03, 2002 8:25 AM
> >Subject: Multiple URLs/Single IP
> >
> >
> > > How can I map multiple URLs, e.g. www.aa.com and www.bb.com, which
> are
> > > pointed to a single IP address, e.g. 210.34.247.21, to multiple
> web
> > > applications, e.g. webapps/aa and webapps/bb?  Many thanks for any
> help.
> >I
> > > have had a solution offered with a Layer-7 Switch and a squid proxy,
> but I
> > > would prefer either Apache or Tomcat solutions by far.  I see
> nothing in
> > > the documentation or in the lists.  I know how to do this with a
> context
> > > manager for JBoss and Tomcat 3.2.4, but I am moving to SOAP as my
> solution
> > > of choice with the Struts package.  Any help would be greatly
> > > appreciated.  Thanks, gents and ladies.
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> ><ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> ><ma...@jakarta.apache.org>
> > >
> >
> >
> >--
> >To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> >For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Bill Barker <wb...@wilshire.com>.
The underlying VirtualHost entries can then Include the directives to the
Tomcat instance that handles that vhost.  If you want one Tomcat, then you
can use mod_rewrite (within the VirtualHost) to direct to the correct
Context.
----- Original Message -----
From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Sunday, February 03, 2002 10:09 PM
Subject: Re: Multiple URLs/Single IP


> Thanks, Bill.  However, I looked at the documentation.  What makes you
> think that solves this problem?  I am not saying you are wrong, but I
don't
> see how that does it.
>
> Micael
>
> At 03:44 PM 2/3/02 -0800, you wrote:
> >This is largely what NameVitualHost(s) are for in Apache.  See:
> >http://httpd.apache.org/docs/mod/core.html#namevirtualhost
> >----- Original Message -----
> >From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
> >To: <to...@jakarta.apache.org>
> >Sent: Sunday, February 03, 2002 8:25 AM
> >Subject: Multiple URLs/Single IP
> >
> >
> > > How can I map multiple URLs, e.g. www.aa.com and www.bb.com, which are
> > > pointed to a single IP address, e.g. 210.34.247.21, to multiple web
> > > applications, e.g. webapps/aa and webapps/bb?  Many thanks for any
help.
> >I
> > > have had a solution offered with a Layer-7 Switch and a squid proxy,
but I
> > > would prefer either Apache or Tomcat solutions by far.  I see nothing
in
> > > the documentation or in the lists.  I know how to do this with a
context
> > > manager for JBoss and Tomcat 3.2.4, but I am moving to SOAP as my
solution
> > > of choice with the Struts package.  Any help would be greatly
> > > appreciated.  Thanks, gents and ladies.
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> ><ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> ><ma...@jakarta.apache.org>
> > >
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Micael Padraig Og mac Grene <ca...@harbornet.com>.
Thanks, Bill.  However, I looked at the documentation.  What makes you 
think that solves this problem?  I am not saying you are wrong, but I don't 
see how that does it.

Micael

At 03:44 PM 2/3/02 -0800, you wrote:
>This is largely what NameVitualHost(s) are for in Apache.  See:
>http://httpd.apache.org/docs/mod/core.html#namevirtualhost
>----- Original Message -----
>From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
>To: <to...@jakarta.apache.org>
>Sent: Sunday, February 03, 2002 8:25 AM
>Subject: Multiple URLs/Single IP
>
>
> > How can I map multiple URLs, e.g. www.aa.com and www.bb.com, which are
> > pointed to a single IP address, e.g. 210.34.247.21, to multiple web
> > applications, e.g. webapps/aa and webapps/bb?  Many thanks for any help.
>I
> > have had a solution offered with a Layer-7 Switch and a squid proxy, but I
> > would prefer either Apache or Tomcat solutions by far.  I see nothing in
> > the documentation or in the lists.  I know how to do this with a context
> > manager for JBoss and Tomcat 3.2.4, but I am moving to SOAP as my solution
> > of choice with the Struts package.  Any help would be greatly
> > appreciated.  Thanks, gents and ladies.
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> > For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multiple URLs/Single IP

Posted by Bill Barker <wb...@wilshire.com>.
This is largely what NameVitualHost(s) are for in Apache.  See:
http://httpd.apache.org/docs/mod/core.html#namevirtualhost
----- Original Message -----
From: "Micael Padraig Og mac Grene" <ca...@harbornet.com>
To: <to...@jakarta.apache.org>
Sent: Sunday, February 03, 2002 8:25 AM
Subject: Multiple URLs/Single IP


> How can I map multiple URLs, e.g. www.aa.com and www.bb.com, which are
> pointed to a single IP address, e.g. 210.34.247.21, to multiple web
> applications, e.g. webapps/aa and webapps/bb?  Many thanks for any help.
I
> have had a solution offered with a Layer-7 Switch and a squid proxy, but I
> would prefer either Apache or Tomcat solutions by far.  I see nothing in
> the documentation or in the lists.  I know how to do this with a context
> manager for JBoss and Tomcat 3.2.4, but I am moving to SOAP as my solution
> of choice with the Struts package.  Any help would be greatly
> appreciated.  Thanks, gents and ladies.
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>