Link to home
Start Free TrialLog in
Avatar of yac678
yac678

asked on

configuring virtual hosts on Tomcat 5.5

I need to configure two virtual hosts on my tomcat server so that I could run two different web applications depending on the domain used. I am following instructions on http://tomcat.apache.org/tomcat-5.5-doc/virtual-hosting-howto.html#Configuring_Your_Contexts

I added the follwoing lines to my server.xml file:

    <Host name="crazydeal.co.il"    appBase="ROOT" autoDeploy="true"/>
    <Host name="www.keywords-4-websites.com" appBase="keywords" autoDeploy="true">
        <Alias>keywords-4-websites.com</Alias>
    </Host>

The applications are deployed under webapps/ROOT and webapps/keywords. When I hit either URL in the browser I don't get anything from tomcat (i.e. a blank page). Both URLs worked fine previously, that is before I added  the virtual hosts definition - the keywords application had the context "keywords" so it did not colide with the other application. I now removed the context and now both applications will have conflicting pages unless I use virtual hosts. Any idea what is going on?
ASKER CERTIFIED SOLUTION
Avatar of Linux Guru
Linux Guru
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yac678
yac678

ASKER

I don't quite understand. I already have an Engine definition which has  defaultHost="localhost", and a host definition which comes after tomcat installaion as follows (in addition to the other 2 I already mentioned):

<Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
...
 </Host>
so wouldn't it be problematic to have appBase="webapps" as you mentioned? Or should I removed the default host?
Avatar of yac678

ASKER

testez,
Forget my previous comment. Your solution worked!