Skip to content

Tomcat configuration

claymccoy edited this page Jun 25, 2012 · 6 revisions

Tomcat Configuration

  • Context Root
    • Set Asgard's context root to an empty string in order to omit the war file name from URLs.
    • See docBase and path in the example below.
  • Port
    • Change the server's port number if you wish. See port in the example below.
    • Set the port to 80 if you want all web traffic for your box to go to Asgard.
    • Set the port to something else if you might have other systems using port 80 on the same box.
    • Routing traffic through an Apache web server is optional.
    • On Linux you can use IP tables to route port 80 traffic to your preferred Tomcat port.

Example tomcat/conf/server.xml

Tested with Tomcat 7

<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000"
               redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
      <Host appBase="webapps" autoDeploy="false" deployOnStartup="false"
            name="localhost" unpackWARs="true" xmlValidation="false"
            xmlNamespaceAware="false">
        <Context className="org.apache.catalina.core.StandardContext"
                 cachingAllowed="true"
                 charsetMapperClass="org.apache.catalina.util.CharsetMapper"
                 cookies="true" crossContext="false" displayName="Welcome to Asgard"
                 docBase="asgard.war" path="" privileged="false"
                 reloadable="false" swallowOutput="false" useNaming="true"
                 wrapperClass="org.apache.catalina.core.StandardWrapper">
        </Context>
        <Valve className="org.apache.catalina.valves.AccessLogValve" 
               pattern="'%h %t &quot;%r&quot; %s %Dms %b"/>
      </Host>
    </Engine>
  </Service>
</Server>