Domains on Tomcat (v5.x)
Using Tomcat to host multiple domains.
You want to add www.example.com to Tomcat.
Locate the server.xml under config in your tomcat dir.
You can add the following:
<Host name="example.com"
debug="0"
appBase="webapps/example.com"
unpackWARs="true"
autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
prefix="example.com\_log."
suffix=".txt" timestamp="true"/>
<Alias>www.example.com</Alias>
</Host>
The alias tag is the domain you want to use.
When someone type the www.example.com in their browser (you must setup the dns correctly), the Tomcat motor looks up this file and finds the www.example.com in the xml file.
Make the webapps/example.com/ a ROOT context.
Go to the config/Catalina/ folder.
Create a folder named example.com.
Create a file ROOT.xml here.
The following code makes the webapps/example.com/ akt as a ROOT folder.
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="example.com"
docBase=""
path=""
workDir="work/Catalina/example.com/_">
</Context>
By doing this you can add as many domains as you want, and get folders in the webapps folder to act as a ROOT context for each domain.