• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Virtual Hosting on Tomcat 7 - always route to the default host

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm trying to configure virtual hosts on my tomcat 7 installation.
No matter what I did, tomcat route all the request to the "defaulthost" property which I defined in the server.xml file.

Here is the server.xml file, as you can see all the requests will be route to the "api" vhost.

<Engine name="Catalina" defaultHost="api">

<Realm className="org.apache.catalina.realm.LockOutRealm">

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>

<Host name="api" appBase="api"
unpackWARs="true" autoDeploy="true">

<Alias>api.tl.com</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />

</Host>
<Host name="site"
unpackWARs="true" autoDeploy="true">
<Alias>tl.com</Alias>
<Alias>www.tl.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="author_log." suffix=".txt"
timestamp="true"/>
</Host>
<Host name="tl" appBase="tl"
unpackWARs="true" autoDeploy="true">
<Alias>tl.tl.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="author_log." suffix=".txt"
timestamp="true"/>
</Host>
<Host name="dev" appBase="dev"
unpackWARs="true" autoDeploy="true">
<Alias>dev.tl.com</Alias>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="author_log." suffix=".txt"
timestamp="true"/>
</Host>
</Engine>


I also define to each vhost the docBase directory, for example :

yair@ubuntu:~/tomcat$ cat conf/Catalina/site/ROOT.xml
<Context path="" docBase="/servers/yair/tomcat/site/ROOT" />

I'm using apache-tomcat-7.0.20 on ubuntu.

Appreciate any help !

Thanks,
Yair


 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic