Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Fronting Apache Tomcat with Apache Http
Note

Incomplete...work in progress

1. Download the Apache Tomcat connector

2. You will need to adjust the Apache Tomcat server.xml file to utilize the connector as follows:

  • Shutdown tomcat
  • Open server.xml for editing (/path/to/your/apache-tomcat/conf/server.xml)
  • Comment out the default connector as shown below:
No Format

<!-- Define a non-SSL HTTP/1.1 Connector on port 8080
    <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/> -->
  • Now, uncomment the following connector block:
    No Format
    
       <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="8009"
                   enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    
    
  • You may adjust the port (port="8009") if you wish.

3. Now, you need to do some configuring on Apache Httpd to connect to Tomcat. You have two options:

...

      Option #1 mod_jk

...

       Note: Configuring with IIS : http://tomcat.apache.org/connectors-doc/reference/iis.html

  • Navigate to your Apache config directory
    No Format
    
    cd /path/to/apache/config
    
  • Open httpd.conf for editing and locate the LoadModule section and make sure you have the mod_jk path defined (path may vary).
    No Format
    
    LoadModule jk_module "/usr/lib/httpd/modules/mod_jk.so"
    
  • In the same file, httpd.conf, define the IfModule directive
    No Format
    
    <IfModule mod_jk.c>
      JkWorkersFile "/path/to/apache/config/workers.properties"
      JkLogFile "/path/to/apache/logs/mod_jk.log"
      JkLogLevel debug
      JkMount /*.jsp worker1
      JkMount /path/to/portal/* worker1
    </IfModule>
    JkMountCopy All
    
  • Now, we need to configure the workers.properties file ( You may include the workers.properties file in the apache config directory, but the path must match with the httpd.conf file where you defined the JkWorkersFile path above.)
    No Format
    
    #Below is an example of a workers.properties file.
    # Define 1 real worker using ajp13
    worker.list=worker1
    
    # Set properties for worker1 (ajp13)
    worker.worker1.type=ajp13
    worker.worker1.host=<your host address>
    
    # Set the port accordingly. You may adjust the port below
    worker.worker1.port=8443
    
    # Below may vary as these are just examples of what can be included.
    worker.worker1.lbfactor=50
    worker.worker1.cachesize=10
    worker.worker1.cache_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.socket_timeout=300
    
    More information about workers.properties can be found here.

...

       Option #2 mod_proxy

...

       References

SSL configuration

...