Step by step:
1. edit conf/server.xml and add a <host> section inside the <engine> tag
that looks like this:-
<Host name="yourhost.com" appBase="yourhostapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
2. create a directory inside your tomcat home directory called
"yourhostapps" as defined above e.g. mkdir $tomcathome/yourhostapps
3. create a directory $tomcathome/conf/Catalina/yourhost
4. create a file in $tomcathome/conf/Catalina/yourhost called ROOT.xml,
making sure ROOT is all upper case, that contains the context for your
app e.g.
<Context path=""
docBase="$tomcathome/somewhereNotInTheAppbase/myapp.war" reloadable="true">
<Resource name="jdbc/groupie"
auth="Container"
type="javax.sql.DataSource"
username="fred"
password="fred123"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://127.0.0.1:5432/mydbname"
maxActive="20" maxIdle="10" maxWait="-1"
/>
</Context>
(note the jdbc Resource is optional but I thought it might be useful :-)
make sure you put the db driver jar in the lib directory)
5. start tomcat e.g. $tomcathome/bin/startup.sh
I like to tail -f $tomcathome/logs/catalina.out too :-)
On 20/02/10 18:28, Eric P wrote:
I'm struggling big time trying to set up a virtual host in Tomcat.
I'm running Tomcat version 6.0.18 under Linux and nothing else (i.e.,
no Apache web server, etc.).
I've read the official 6.0 docs here over and over.
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
But it seems like these docs are trying to give me a whole new context
where I can put more webapps (maybe I'm missing the point), but I
merely want to be able to point my browser at something arbitrary like
www.dummy.com (or www.dummy.com:8080) and have an app deployed under
/webapps/dummy be served w/o the need to add /dummy to the end of the
URL.
Can anyone give point me to simple instructions for setting this up?
Thanks and sorry for being so pathetic. I've read probably a dozen
forum posts and articles (and tried about ~30 different configurations
in server.xml) but nothing has worked for me. Also, it seems like the
way to set this up under 6.* has changed a bit. After going back and
forth between including a <Context...> and omitting it (the 6.* way?)
I'm absolutely confused.
Thanks for reading!
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org