Solved

configuring virtual hosts on Tomcat 5.5

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Website authentication - asp.net 3 83
Apache / XAMPP  authorisation 10 58
Error viewing ASP page 12 166
Forms that calculate points for wordpress 10 29
Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
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…
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.

821 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