Solved

configuring virtual hosts on Tomcat 5.5

Posted on 2010-08-15
3
491 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
[X]
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
  • 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

691 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