Tomcat Mod_jk

 

I have a website with apache 1.3(SSL enabled) + modjk + tomcat 5.5 on Linux redhad setup. Just recently i started having a downtime problem with my web site. Once a day, i get my web site hang on port 80. But if i access directly through 8080 tomcat responses and web site works fine. Tomcat Connectors (modjk) Downloads Use the links below to download the Apache Tomcat ® Connectors software from one of our mirrors. You must verify the integrity of the downloaded files using signatures downloaded from our main distribution directory.

Skip to end of metadataGo to start of metadata
Configure Apache HTTPd as a reverse proxy (mod_proxy)Configuring a remote Apache HTTP server

The communication between the HTTP server and Geronimo can also be done via AJP connectors. By default, both Apache Geronimo distributions (Jetty and Tomcat) have already predefined one AJP13 connector listening on port 8009.

Tomcat Mod_jk Secret

The Jakarta Tomcat Connector mod_jk module is provided as a connector from Apache Tomcat source. Both Jetty and Tomcat are fully compatible with this connector. This module is available when you download the Tomcat source, but you can also download it separately. See http://tomcat.apache.org/download-connectors.cgi for the proper version for your system.

In addition to mod_jk, you will require a workers.properties file, also available with the Apache Tomcat source distribution. This properties file tells the mod_jk plugin how to connect to the Geronimo server. For a detailed explanation on all the available options for configuring the Jakarta Tomcat Connector, visit http://tomcat.apache.org/connectors-doc/config/workers.html.

For practical purposes, the module mod_jk-apache-2.2.3.so for Windows and the workers.properties are included in the Attachments section in this article.

Download the appropriate mod_jk for your platform from the Tomcat web site. For this particular example, rename it to mod_jk.so and copy it into the <httpd_home>modules directory. Download and extract the workers.properties file from the Apache Tomcat source (alternatively, download it from the Attachments section) to the <httpd_home>conf directory.

Tomcat

Edit the httpd.conf file located in the <httpd_home>conf directory to load the Jakarta Tomcat Connector mod_jk module. Add the following lines at the end of the httpd.conf file.

JkMount will map anything behind /console/ to the worker ajp13. The name ajp13 is defined in the workers.properties file, which is described in the following section. You might need to add more JkMount directives depending on the applications you want to be accessed via the remote HTTPd.

In this example, the console has been enabled just for demonstration purposes. In a production environment, you do not want to have the console accessible from the other network (normally the Internet). Having the console accessible represents a big security exposure.

The rule is that everything should have restricted access. Normally, a firewall would be placed in between the HTTP and the application server (depending on the topology) and you should map just the minimum resources necessary to have your application working from the other side.

The workers.properties file, among other things, tells the HTTPd where the Geronimo server is, what version of AJP to use and the port where Geronimo is listening.

Edit the workers.properties file located in the <httpd_home>conf directory to match your environment. The following example is an excerpt from the workers.properties file with just the variables you should focus on.

From this example, note how the name of the worker is defined. Look at the variables definition worker.ajp13 , where ajp13 is the worker name you specified earlier in the httpd.conf file.

Tomcat Mod_jk

As the last step, stop and restart the Apache HTTPd to ensure these changes are loaded.

For testing this configuration, make sure both Geronimo and HTTPd are up and running.

  1. Check Geronimo connectivity by accessing http://localhost:8080/console , you should see the Geronimo Administration Console.
  2. Check HTTPd connectivity by accessing http://localhost , you should see the Apache HTTPd welcome page.
  3. Check the HTTPd - Geronimo request forwarding by accessing http://localhost/console/ , you shoud be redirected to the Geronimo Administration Console. Note that at the end of the URL, there is a '/', failing to include this / will result in a Not Found error triggered by the Jakarta Tomcat Connector module.

Apache Tomcat Mod_jk

mod_jk is an Apache module used to connect the Tomcatservlet container with web servers such as Apache, iPlanet, Sun ONE (formerly Netscape) and even IIS using the Apache JServ Protocol.

A web server waits for client HTTP requests. When these requests arrive, the server does what is needed to serve the requests by providing the necessary content.

Tomcat Mod_jk Workers.properties

Adding a servlet container alters this behavior. Now the web server needs also to:

  • Load the servlet container adapter library and initialize it (prior to serving requests).
  • When a request arrives, it needs to check and see if a certain request belongs to a servlet, if so it needs to let the adapter take the request and handle it.

The adapter needs to know what requests it is going to serve, usually based on some pattern in the request URL, and to where to direct these requests.

Things are more complex when the user wants to set a configuration that uses virtual hosts, or when they want multiple developers to work on the same web server but on different servlet container JVMs.

See also[edit]

External links[edit]


Retrieved from 'https://en.wikipedia.org/w/index.php?title=Mod_jk&oldid=1000814717'