You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dola Woolfe <do...@yahoo.com> on 2005/09/16 20:43:57 UTC
Help figuring out Virtual Hosts
Hi,
I've certainly RTFM'd and had thoroughly read
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Host%20Name%20Aliases
but I just can't figure out how to get virtual servers
to work.
Basically, assume that DNS is set up properly and that
ServerA.com ServerB.com and Server.com resolve to the
same IP. Now, I want ServerA.com to "go to"
Server.com/MyAppA/index.jsp and ServerB.com to "go to"
Server.com/MyAppB/index.jsp. This, in my mind is sort
of like how Apache lets you do it, where of course it
takes advantage of the convention of index.html being
the default destination.
OK, how do I achieve this with Tomcat? Could anyone
please provide a specific example?
Many thanks,
Dola
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Help figuring out Virtual Hosts
Posted by Tom Burke <to...@expensys.com>.
Hassan
You posted this answer out a week or more ago. I'd just to like to
respond by saying that I, too, had a problem with virtual hosts and was
able to solve it by following your comments. In particular I had not
understood before that I needed to have a ROOT.xml in the virtual host's
context.
Tom Burke
----- Original Message -----
From: "Hassan Schroeder" <ha...@webtuitive.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Friday, October 14, 2005 3:09 AM
Subject: Re: Help figuring out Virtual Hosts
> Dola Woolfe wrote:
>
>> All I want is for the user to be able to enter
>> "serverA" in his/her browser and be forwarded to
>> "http://server/appA/index.jsp" and the enter "serverB"
>> and be forwarded to "http://server/appB/index.jsp".
>
> There is no "forwarding" to be done.
>
> You have two hosts, 'serverA' and 'serverB'; create Host elements
> for each of them. Set the ROOT context of 'serverA' to your appA,
> and the ROOT context of 'serverB' to your appB.
>
> <Host name="serverA" appBase="/apps/A"></Host>
>
> <Host name="serverB" appBase="/apps/B"></Host>
>
> :: and "appA" is in '/apps/A/ROOT/', "appB" is in '/apps/B/ROOT'
>
> You'll need e.g. either a '/apps/A/ROOT/META-INF/context.xml' file
> or "$CATALINA_HOME/conf/serverA/ROOT.xml" for each context.
>
> That's all there is to it. Really :-)
>
> --
> Hassan Schroeder ----------------------------- hassan@webtuitive.com
> Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
>
> dream. code.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Help figuring out Virtual Hosts
Posted by Hassan Schroeder <ha...@webtuitive.com>.
Tom Burke wrote:
> Now I am trying to replicate the configuration on a Linux server.
And there's no difference, other than the direction of the path
separators :-)
> I have
> configured a second host entry in server.xml, it has a doc-base and the
> doc-base directory exists. I am now trying to make the Manager/html
> application visible from this virtual host - obviously, or I won't be
> able to deplay Wars to it. However when I enter the URL to start the
> manager/html app, I get the login box, I log in and then I get a screen
> that says: 'The requested resource (Servlet HTMLManager is not
> available) is not available'.
>
> I've noticed a big difference between the Windows installation and the
> Linux one. The Windows version has a ROOT directory in each doc-base
> directory, and it was the fact that this was not in the virtual hosts's
> doc-base directory that was preventing it from working. On the linux
> server, however, there is no ROOT directory in either doc-base
> directory, either the default one (webapps) or the v-host's.
You keep referring above to "doc-base", but it sounds like you mean
"appBase". A Host has an *appBase* for its contexts, a *Context* has
a docBase. From my prior example:
> You have two hosts, 'serverA' and 'serverB'; create Host elements
> for each of them. Set the ROOT context of 'serverA' to your appA,
> and the ROOT context of 'serverB' to your appB.
>
> <Host name="serverA" appBase="/apps/A"></Host>
>
> <Host name="serverB" appBase="/apps/B"></Host>
Note that "appBase" is set for each. Now you can either create the
directories, e.g. '/apps/A/ROOT/' or deploy '/apps/A/ROOT.war'
You'll need to describe each webapp in either e.g.
$CATALINA_HOME/conf/Catalina/serverA/ROOT.xml
or
/apps/A/ROOT/META-INF/context.xml
To use the manager on each, copy the provided 'manager.xml' file
into each of
$CATALINA_HOME/conf/Catalina/serverA/manager.xml
$CATALINA_HOME/conf/Catalina/serverB/manager.xml
Now you should be able to get to 'http://serverA/manager/html' and
'http://serverB/manager/html' (after a Tomcat restart, of course).
HTH!
--
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Help figuring out Virtual Hosts
Posted by Tom Burke <to...@expensys.com>.
I wrote a few days ago saying that the contribution below had solved my
problems. Not entirely... They did so when attempting to configure
virtual hosts on a test machine within my own network on a Windows XP
laptop.
Now I am trying to replicate the configuration on a Linux server. I have
configured a second host entry in server.xml, it has a doc-base and the
doc-base directory exists. I am now trying to make the Manager/html
application visible from this virtual host - obviously, or I won't be
able to deplay Wars to it. However when I enter the URL to start the
manager/html app, I get the login box, I log in and then I get a screen
that says: 'The requested resource (Servlet HTMLManager is not
available) is not available'.
I've noticed a big difference between the Windows installation and the
Linux one. The Windows version has a ROOT directory in each doc-base
directory, and it was the fact that this was not in the virtual hosts's
doc-base directory that was preventing it from working. On the linux
server, however, there is no ROOT directory in either doc-base
directory, either the default one (webapps) or the v-host's.
Can anyone suggest where to start looking? I'm running Tomcat 5.0.25,
btw.
Tom Burke
----- Original Message -----
From: "Hassan Schroeder" <ha...@webtuitive.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Friday, October 14, 2005 3:09 AM
Subject: Re: Help figuring out Virtual Hosts
> Dola Woolfe wrote:
>
>> All I want is for the user to be able to enter
>> "serverA" in his/her browser and be forwarded to
>> "http://server/appA/index.jsp" and the enter "serverB"
>> and be forwarded to "http://server/appB/index.jsp".
>
> There is no "forwarding" to be done.
>
> You have two hosts, 'serverA' and 'serverB'; create Host elements
> for each of them. Set the ROOT context of 'serverA' to your appA,
> and the ROOT context of 'serverB' to your appB.
>
> <Host name="serverA" appBase="/apps/A"></Host>
>
> <Host name="serverB" appBase="/apps/B"></Host>
>
> :: and "appA" is in '/apps/A/ROOT/', "appB" is in '/apps/B/ROOT'
>
> You'll need e.g. either a '/apps/A/ROOT/META-INF/context.xml' file
> or "$CATALINA_HOME/conf/serverA/ROOT.xml" for each context.
>
> That's all there is to it. Really :-)
>
> --
> Hassan Schroeder ----------------------------- hassan@webtuitive.com
> Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
>
> dream. code.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Help figuring out Virtual Hosts
Posted by Hassan Schroeder <ha...@webtuitive.com>.
Dola Woolfe wrote:
> All I want is for the user to be able to enter
> "serverA" in his/her browser and be forwarded to
> "http://server/appA/index.jsp" and the enter "serverB"
> and be forwarded to "http://server/appB/index.jsp".
There is no "forwarding" to be done.
You have two hosts, 'serverA' and 'serverB'; create Host elements
for each of them. Set the ROOT context of 'serverA' to your appA,
and the ROOT context of 'serverB' to your appB.
<Host name="serverA" appBase="/apps/A"></Host>
<Host name="serverB" appBase="/apps/B"></Host>
:: and "appA" is in '/apps/A/ROOT/', "appB" is in '/apps/B/ROOT'
You'll need e.g. either a '/apps/A/ROOT/META-INF/context.xml' file
or "$CATALINA_HOME/conf/serverA/ROOT.xml" for each context.
That's all there is to it. Really :-)
--
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Help figuring out Virtual Hosts
Posted by Dola Woolfe <do...@yahoo.com>.
Hi,
Getting back to this on a delay because:
I just can't figure it out!!!
This is probably because I'm dumb, but it's just too
complicated for me. Can someone please provide an
example that would illustrate how to do this?
All I want is for the user to be able to enter
"serverA" in his/her browser and be forwarded to
"http://server/appA/index.jsp" and the enter "serverB"
and be forwarded to "http://server/appB/index.jsp". I
keep hoping that this would be as simple as it was for
Apache, but apparently it is not.
I'm not proud of my ignorance, but I don't know what
is Engine vs. Container vs Context etc. It seems that
for a semi-involved JSP project one now needs to have
a JSP programmer and a Tomcat administrator. (This
didn't use to be the case.)
Like I mentioned, an example would be greatly
appreciated.
Thank you.
Dola
--- Jilles van Gurp <in...@jillesvangurp.com>
wrote:
> You can use multiple hosttags in the server.xml,
> each with their own
> context. As described here
>
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html
>
> "One or more Host elements are nested inside an
> Engine element. Inside
> the Host element, you can nest Context elements for
> the web applications
> associated with this virtual host. Exactly one of
> the Hosts associated
> with each Engine MUST have a name matching the
> defaultHost attribute of
> that Engine."
>
> You give each application its own host and it should
> work fine. You can
> also use alias tags inside a host tag if you want an
> application to be
> available for multiple hosts.
>
> Jilles
>
>
>
> Dola Woolfe wrote:
> > Hi,
> >
> > I've certainly RTFM'd and had thoroughly read
> >
> >
>
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Host%20Name%20Aliases
> >
> > but I just can't figure out how to get virtual
> servers
> > to work.
> >
> > Basically, assume that DNS is set up properly and
> that
> > ServerA.com ServerB.com and Server.com resolve to
> the
> > same IP. Now, I want ServerA.com to "go to"
> > Server.com/MyAppA/index.jsp and ServerB.com to "go
> to"
> > Server.com/MyAppB/index.jsp. This, in my mind is
> sort
> > of like how Apache lets you do it, where of course
> it
> > takes advantage of the convention of index.html
> being
> > the default destination.
> >
> > OK, how do I achieve this with Tomcat? Could
> anyone
> > please provide a specific example?
> >
> > Many thanks,
> >
> > Dola
> >
> >
> >
> > __________________________________
> > Yahoo! Mail - PC Magazine Editors' Choice 2005
> > http://mail.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> >
> >
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
>
>
__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Help figuring out Virtual Hosts
Posted by Jilles van Gurp <in...@jillesvangurp.com>.
You can use multiple hosttags in the server.xml, each with their own
context. As described here
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html
"One or more Host elements are nested inside an Engine element. Inside
the Host element, you can nest Context elements for the web applications
associated with this virtual host. Exactly one of the Hosts associated
with each Engine MUST have a name matching the defaultHost attribute of
that Engine."
You give each application its own host and it should work fine. You can
also use alias tags inside a host tag if you want an application to be
available for multiple hosts.
Jilles
Dola Woolfe wrote:
> Hi,
>
> I've certainly RTFM'd and had thoroughly read
>
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html#Host%20Name%20Aliases
>
> but I just can't figure out how to get virtual servers
> to work.
>
> Basically, assume that DNS is set up properly and that
> ServerA.com ServerB.com and Server.com resolve to the
> same IP. Now, I want ServerA.com to "go to"
> Server.com/MyAppA/index.jsp and ServerB.com to "go to"
> Server.com/MyAppB/index.jsp. This, in my mind is sort
> of like how Apache lets you do it, where of course it
> takes advantage of the convention of index.html being
> the default destination.
>
> OK, how do I achieve this with Tomcat? Could anyone
> please provide a specific example?
>
> Many thanks,
>
> Dola
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org