Solved

configuring virtual hosts on Tomcat 5.5

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apache Issues 9 66
Does it make sense migrate a website to MIcrosoft Azure 4 48
Problem to go to Web page 2 100
Apache/PHP: Cannot make phpinfo() and phpmyadmin work 4 37
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
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…

867 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

21 Experts available now in Live!

Get 1:1 Help Now