Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

configuring virtual hosts on Tomcat 5.5

Posted on 2010-08-15
3
485 Views
Last Modified: 2013-12-02
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?
0
Comment
Question by:yac678
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
LinuxGuru earned 500 total points
ID: 33440759
Hi,

Could you please try to enter the docbase as mentioned below ?

<Host name="domain.com" debug="0" appBase="webapps" unpackWARs="true">
 <Alias>www.domain.com</Alias>
 <Logger className="org.apache.catalina.logger.FileLogger"
 directory="logs" prefix="virtual_log1." suffix=".log" timestamp="true"/>
 <Context path="" docBase="/home/maindomain.com/private/webapps/domain"  
 debug="0" reloadable="true"/>
 </Host>

Please replace the domain.com with the new domain you want to add and the set the "docBase" path

Hope this helps.

Also restart the tomcat to see the changes.
0
 

Author Comment

by:yac678
ID: 33441798
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?
0
 

Author Comment

by:yac678
ID: 33441930
testez,
Forget my previous comment. Your solution worked!
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using Quotation Marks in PHP This question (http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28217211.html) seems to come up a lot for developers who are new to PHP.  And it got me thinking, "How can we explain the rule…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question