Sunday, 22 May 2011

Configure Apache Tomcat Hosts in server.xml

Backup server.xml
Before we start editing this file, let’s make a copy :)
cd /usr/share/apache-tomcat-7.0.12/conf
cp server.xml server.xml.backup


Edit server.xml and insert a new Host
vi server.xml (and add the code below after last Host)
<Host name="www.example.com" appBase="/usr/share/apache-tomcat-7.0.12/webapps/example.com">
<Alias>example.com</Alias>
<Context path="" reloadable="true" docBase="/usr/share/apache-tomcat-7.0.12/webapps/example.com" debug="1" />
<Context path="/manager" debug="0" privileged="true" docBase="/usr/share/apache-tomcat-7.0.12/webapps/manager">
</Context>
</Host>


Test your Host
cd /usr/share/apache-tomcat-7.0.12/bin
./shutdown.sh
./startup.sh

If Tomcat is running again then the syntax is good and the files exist.

No comments:

Post a Comment