permaculture playing cards*
The moose likes Tomcat and the fly likes virtual hosts in stand alone tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "virtual hosts in stand alone tomcat" Watch "virtual hosts in stand alone tomcat" New topic
Author

virtual hosts in stand alone tomcat

Diego Garcia
Greenhorn

Joined: Sep 14, 2004
Posts: 16
Hello everyone,

I have tomcat installed and i am trying to configure virtual hosts.

What i need is something like:
http://test1:8080/index.jsp for one aplication and
http://test2:8080/index.jsp for another.

Both applications are in a "web" directory outside webapps (at the same level)

This is part of my server.xml file:


Really, i can�t get it to work, can someone please assist me here?

Thanks in advance
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
I am using one instance of Tomcat 5.5.9 to host about 6 different "sites" - your <Host name= attribute has to exactly match the way the host appears in URLs.
I also found that I had to give an absolute path for appBase.
Bill
Diego Garcia
Greenhorn

Joined: Sep 14, 2004
Posts: 16
Thank you Bill for your response.

Now my Host looks like:


I changed the appBase to an absolute path, but still not working...

What do you mean exactly when you say that the name attribute has to match the host name?

Also, do i have to remove the localhost entry that comes with the initial server.xml?

Thanks again.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
I left the localhost Host entry because the Engine uses that as defaultHost

The name attribute has to match the host name you use in the URL that addresses that particular host. What you would use when building a URL with the protocol/host/port constructor. So if you want people to be able to use either www.mysite.com or mysite.com, you have to have a separate Host entry for each name.

So what happens when you try to start Tomcat from a command prompt? Surely there must be some errors if it is not happy with the Host configuration.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: virtual hosts in stand alone tomcat