Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Virtual Hosting with Tomcat 4.x

 
Josh Batchelor
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a hard time getting this to work. Can anyone point in the right direction to get some help or can help me out. I have added the following entries to my server.xml file, and when I go to those entries they all take me to the root folder.
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">

<Host name="mydomain0.com" debug="0" appBase="webapps" unpackWARs="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="mydomain0." suffix=".log" timestamp="true"/>
<Context path="" docBase="mydomain0" debug="0" reloadable="true"/>
<Context path="/mydomain0" docBase="mydomain0" debug="0" reloadable="true"/>
</Host>
<Host name="mydomain1.com" debug="0" appBase="webapps" unpackWARs="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="mydomain1." suffix=".log" timestamp="true"/>
<Context path="" docBase="mydomain1" debug="0" reloadable="true"/>
<Context path="/mydomain1" docBase="mydomain1" debug="0" reloadable="true"/>
</Host>
<Host name="mydomain2.com" debug="0" appBase="webapps" unpackWARs="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="mydomain2." suffix=".log" timestamp="true"/>
<Context path="" docBase="mydomain2" debug="0" reloadable="true"/>
<Context path="/mydomain2" docBase="mydomain2" debug="0" reloadable="true"/>
</Host>
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on how you want to setthis up here is an example that should work for you. This is assuming you want to serve a virtual host from /home/host/www. The trick is to specify your context correctly. This example is setup as a virtual host in tomcat 4.1.18 and being served with apache-tomcat using jk. Let me know if you have any questions.
<Host name="host.domain.com" debug="0" appBase="/home/host" unpackWARs="true">
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" pre
fix="host." suffix=".log" timestamp="true"/>
<Context path="" docBase="www" debug="0" reloadable="true">
</Context>
</Host>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic