Solved

configuring virtual hosts on Tomcat 5.5

Posted on 2010-08-15
3
480 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
This video teaches users how to migrate an existing Wordpress website to a new domain.

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now