tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Alias URL
Date Mon, 05 Oct 2009 21:54:29 GMT
Johnson, Rob E wrote:
> Hi,
>> What you would like is that :
>> - when a user enters the URL "http://imsden.mms" (or "http://imsden.mms:8080"), he
continues to get the standard Tomcat homepage
>> - when a user enters the URL "http://webtop" (or "http://webtop:8080"), he gets immediately
the first page of the "webtop" application
>> Is that correct ?
> This is correct
> Sorry to be slow to respond I have to jump into a few meetings today. 
And sorry if I leave in the middle somewhere, despite my didactic 
instincts.  I have to take a plane at 5:00.
So let's see if I can write this quickly and not forget anything.
(If so, peruse the responses you already got, from me and others, 
because the data is already there).

Anyway then,

(stop Tomcat first)

Step 1 : you will need 2 <Host ..> sections in Tomcat's configuration 
file "server.xml".  Currently, there is only one.

The first and only one you already have, is for the hostname 
"localhost", which is also the "default Host".  Meaning in short that 
Tomcat will use the settings in that first Host section, for any request
- either specifically addressed to "localhost" (of which there should be 
few, since they would have to originate on the same system)
- or for any request that comes in with a "Host: xxxxxx" header, which 
"xxxxx" Tomcat cannot readily associate with a <Host name="xxxxxx" ..> tag

So look for the server.xml file, edit it, duplicate the entire
<Host name="localhost" ..> .... </Host> section that you find there, and 
change the "name=" attribute value to be "webtop" instead of "localhost".

That's basically all it takes to create a new "virtual host" (or "site" 
in MS parlance) into Tomcat.

Also :
- you currently have a ../webapps/ directory under Tomcat.  At the same 
level, create a directory .../webapps2/ .
Then move your complete "webtop/*" webapp under that new directory 
(instead of under /webapps/).
- then, in the new <Host name="webtop" ..> tag that you created 
previously, change the appBase attribute
as follows :
old : appBase="webapps"
new : appBase="webapps2"

Then restart Tomcat.
Now the Host named "localhost" should no longer find an application 
called "webtop". In other words, a browser accessing via 
"http://imsden.mms/webtop" should get an error.
(Because the hostname "imsden.mms" not being found in a Host tag, Tomcat 
will default to the first Host, and its /webapps dir does not have the 
webtop application in it any longer).

But the host named "webtop" should find this application.
In other words, a browser accessing via "http://webtop/webtop" should 
now get the application.

That's getting closer, but..

Step 2 : consists of making this "webtop" application into the default 
application of the host "webtop".
For this, there is a wiki, but in your case it's easier :
Stop Tomcat. Rename /webapps2/webtop/ to /webapps2/ROOT/,
and restart Tomcat.
Then try accessing http://webtop/

Tada !

Or not, but then you need to find another helping hand, cause I'm going 
to catch some sleep.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message