Confluence Docs 3.0 : Guide to using Apache Tomcat's Virtual Hosts This page last changed on Jun 10, 2008 by ukuhnhardt. ### Introduction Sometimes it is necessary to have Tomcat serve different applications on the same context path, but different host names. Most commonly, this is when trying to use a simple mod_proxy configuration with Apache. ### Tomcat configuration Tomcat allows name-based virtual hosting, where the hostname of the request determines which application processes it. The following configuration shows how two virtual hosts can be configured for Jira and Confluence on the same Tomcat instance:
Confluence application server URL | http://confluence-app-server.internal.example.com:8080/
JIRA application server URL | http://jira-app-server.internal.example.com:8080/
Below is a minimal configuration of Tomcat's server.xml which configures separate hosts for JIRA and Confluence on the URLs above.
    <Server port="8005" shutdown="SHUTDOWN">
      <Service name="Catalina">
        <Connector port="8080" />
        <Engine name="Catalina" defaultHost="confluence-app-server.internal.example.com">

          <Host name="confluence-app-server.internal.example.com" appBase="webapps">
    	<Context path="" docBase="/opt/webapps/confluence-2.2/confluence"/>
            <Logger className="org.apache.catalina.logger.FileLogger"/>
          </Host>

          <Host name="jira-app-server.internal.example.com" appBase="webapps">
    	<Context path="" docBase="/opt/webapps/jira-3.6.1/jira.war"/>
            <Logger className="org.apache.catalina.logger.FileLogger"/>
          </Host>

        </Engine>
      </Service>
    </Server>
Points to note: the HTTP connector is accessible on port 8080, as per the URLs above the AJP connector is not included in this minimal configuration. If you want to mod_jk with this configuration, you need to ensure you add it. in the Engine, the Confluence host is configured as the default host. The default host is used if the request doesn't contain a Host header, or is accessed by a name the server doesn't recognise. because the above configuration uses name-based virtual hosting, you need to have entries in your DNS server for "confluence-app-server" and "jira-app-server" that point to the application server ### More information After doing this, you can configure Apache virtual hosts to map subdomains like jira.example.com and confluence.example.com to your application.

Document generated by Confluence on Nov 05, 2009 23:34