Skip to content

Tomcat configuration

jgritman edited this page Dec 11, 2012 · 6 revisions

Tomcat Configuration

Setup

  1. Download the latest war from http://netflix.box.com/asgard/
  2. Download and expand the latest stable Apache Tomcat from http://tomcat.apache.org/
  3. Delete the contents of apache-tomcat-x/webapps/
  4. Copy asgard.war into apache-tomcat-x/webapps/
  5. Set the context root and port. See 'Configuration' below.
  6. Run apache-tomcat-x/bin/startup.sh
  7. See Troubleshooting if there is a problem

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>