geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v3.0 > Configure Apache HTTPd with Jakarta Tomcat Connector (mod_jk)
Date Wed, 26 Jan 2011 06:11:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2036/9/4/_/styles/combined.css?spaceKey=GMOxDOC30&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Configure+Apache+HTTPd+with+Jakarta+Tomcat+Connector+%28mod_jk%29">Configure
Apache HTTPd with Jakarta Tomcat Connector (mod_jk)</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~maojia508">maojia</a>
    </h4>
        <br/>
                         <h4>Changes (15)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{anchor:top} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >The communication between the
HTTP server and Geronimo can <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">be</span>
also <span class="diff-added-words"style="background-color: #dfd;">be</span> done
via AJP connectors. By default, both Apache Geronimo distributions (Jetty and Tomcat) have
already predefined one AJP13 connector listening on port 8009. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">The
Jakarta Tomcat Connector *mod_jk* module is provided as a connector from Apache Tomcat source,
Jetty (and obviously Tomcat) is fully compatible with this connector. This module is avaiable
when you download the Tomcat source, but also is available for download separately. Refer
to http://tomcat.apache.org/download-connectors.cgi for the proper version for your system.
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">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. <br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >In addition to <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">the
mod_jk</span> <span class="diff-added-words"style="background-color: #dfd;">*mod_jk*,</span>
you will require a {{workers.properties}} file, also available with the Apache Tomcat source
distribution. This properties file tells the <span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">*</span>mod_jk<span class="diff-added-chars"style="background-color:
#dfd;">*</span></span> plugin how to connect to the Geronimo server. For a
detailed explanation on all the available options for configuring the Jakarta Tomcat <span
class="diff-changed-words">Connector<span class="diff-added-chars"style="background-color:
#dfd;">,</span></span> visit http://tomcat.apache.org/connectors-doc/config/workers.html.
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{info}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.{info} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>h1. Configure Apache HTTPd
<br></td></tr>
            <tr><td class="diff-changed-lines" >Download the appropriate *mod_jk*
for your platform from the [Tomcat|http://tomcat.apache.org/download-connectors.cgi] web site.
For this particular <span class="diff-changed-words">example<span class="diff-added-chars"style="background-color:
#dfd;">,</span></span> rename it to *mod_jk.so* and copy it into the {{&lt;httpd_home&gt;\modules}}
directory. Download and extract the *workers.properties* <span class="diff-added-words"style="background-color:
#dfd;">file</span> from the Apache Tomcat source (alternatively, download it from
the *Attachments* section) to the {{&lt;httpd_home&gt;\conf}} directory. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Edit the {{httpd.conf}}
file located in the {{&lt;httpd_home&gt;\conf}} directory to load the Jakarta Tomcat
Connector *mod_jk* module. Add the following lines at the end of the {{httpd.conf}} file.
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat}  <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">*JkMount*
will map anything behind */console/* to the worker *ajp13*. The name *ajp13* is defined in
the workers.properties file which is described next. You will need to add more JkMount directives
depending on the applications you want to be accessed via the remote HTTPd. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*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. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >{warning} In this <span class="diff-changed-words">example<span
class="diff-added-chars"style="background-color: #dfd;">,</span></span> the
*console* has been enabled just for <span class="diff-changed-words">demonst<span
class="diff-added-chars"style="background-color: #dfd;">r</span>ation</span>
purposes. In a production <span class="diff-changed-words">environment<span class="diff-added-chars"style="background-color:
#dfd;">,</span></span> you <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">will</span>
<span class="diff-added-words"style="background-color: #dfd;">do</span> not want
to have the *console* accessible from the other network (normally the Internet). Having the
*console* accessible represents a big security exposure. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >The rule is that everything should
have restricted <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">access,
normally</span> <span class="diff-added-words"style="background-color: #dfd;">access.
Normally,</span> a firewall would be placed in between the HTTP and the application
server (depending on the topology) and you should map just the <span class="diff-changed-words">min<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">u</span><span
class="diff-added-chars"style="background-color: #dfd;">i</span>mum</span>
resources necessary to have your application working from the other side.{warning} <br></td></tr>
            <tr><td class="diff-unchanged" > <br>[Back to Top|#top] <br>
<br>h1. Configure workers.properties <br></td></tr>
            <tr><td class="diff-changed-lines" >The <span class="diff-changed-words">{{workers.properties}}<span
class="diff-added-chars"style="background-color: #dfd;"> file</span>,</span>
among other things, tells the HTTPd where the Geronimo server is, what version of AJP <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">should</span>
<span class="diff-added-words"style="background-color: #dfd;">to</span> use and
the port where Geronimo is listening. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Edit the {{workers.properties}}
file located in the {{&lt;httpd_home&gt;\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. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">From
this example note how the name of the worker is defined, look at the variables definition
*worker.ajp13.* , *ajp13* is the worker name you specified earlier in the httpd.conf. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">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. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >As <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">a</span>
<span class="diff-added-words"style="background-color: #dfd;">the</span> last
step, stop and restart the Apache HTTPd to ensure these changes are loaded. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>[Back to Top|#top] <br>
<br>h1. Testing <br></td></tr>
            <tr><td class="diff-changed-lines" >For testing this <span class="diff-changed-words">configuration<span
class="diff-added-chars"style="background-color: #dfd;">,</span></span> make
sure both Geronimo and HTTPd are up and running. <br></td></tr>
            <tr><td class="diff-unchanged" > <br># Check Geronimo connectivity
by accessing http://localhost:8080/console , you should see the Geronimo Administration Console.
<br># Check HTTPd connectivity by accessing http://localhost , you should see the Apache
HTTPd welcome page. <br></td></tr>
            <tr><td class="diff-changed-lines" ># Check the HTTPd - Geronimo request
forwarding by accessing http://localhost/console/ , you shoud be redirected to the Geronimo
Administration Console. Note <span class="diff-added-words"style="background-color: #dfd;">that</span>
at the end of the <span class="diff-changed-words">URL<span class="diff-added-chars"style="background-color:
#dfd;">,</span></span> there is a &quot;/&quot;, failing to include
this / will result in a *Not Found* error triggered by the Jakarta Tomcat Connector module.
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>[Back to Top|#top] <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC30/Configure+Apache+HTTPd+as+a+reverse+proxy+%28mod_proxy%29"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC30/Configure+Apache+HTTPd+as+a+reverse+proxy+%28mod_proxy%29">Configure
Apache HTTPd as a reverse proxy (mod_proxy)</a>&nbsp;</td><td width='33%'
class='ScrollbarParent'><sup><a href="/confluence/display/GMOxDOC30/Configuring+a+remote+Apache+HTTP+server"><img
border='0' align='middle' src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC30/Configuring+a+remote+Apache+HTTP+server">Configuring
a remote Apache HTTP server</a></td><td width='33%' class='ScrollbarNextName'>&nbsp;</td></tr></table></div>
<p><a name="ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-top"></a></p>

<p>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.</p>

<p>The Jakarta Tomcat Connector <b>mod_jk</b> 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 <a href="http://tomcat.apache.org/download-connectors.cgi" class="external-link"
rel="nofollow">http://tomcat.apache.org/download-connectors.cgi</a> for the proper
version for your system.</p>


<p>In addition to <b>mod_jk</b>, you will require a <tt>workers.properties</tt>
file, also available with the Apache Tomcat source distribution. This properties file tells
the <b>mod_jk</b> plugin how to connect to the Geronimo server. For a detailed
explanation on all the available options for configuring the Jakarta Tomcat Connector, visit
<a href="http://tomcat.apache.org/connectors-doc/config/workers.html" class="external-link"
rel="nofollow">http://tomcat.apache.org/connectors-doc/config/workers.html</a>.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td>For practical purposes,
the module <a href="/confluence/download/attachments/20645305/mod_jk-apache-2.2.3.so?version=1&amp;modificationDate=1203512952000">mod_jk-apache-2.2.3.so</a>
for Windows and the <a href="/confluence/download/attachments/20645305/workers.properties?version=1&amp;modificationDate=1203512952000">workers.properties</a>
are included in the <b>Attachments</b> section in this article.</td></tr></table></div>

<p><a href="#ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-top">Back
to Top</a></p>

<h1><a name="ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-ConfigureApacheHTTPd"></a>Configure
Apache HTTPd</h1>
<p>Download the appropriate <b>mod_jk</b> for your platform from the <a
href="http://tomcat.apache.org/download-connectors.cgi" class="external-link" rel="nofollow">Tomcat</a>
web site. For this particular example, rename it to <b>mod_jk.so</b> and copy
it into the <tt>&lt;httpd_home&gt;\modules</tt> directory. Download and
extract the <b>workers.properties</b> file from the Apache Tomcat source (alternatively,
download it from the <b>Attachments</b> section) to the <tt>&lt;httpd_home&gt;\conf</tt>
directory.</p>

<p>Edit the <tt>httpd.conf</tt> file located in the <tt>&lt;httpd_home&gt;\conf</tt>
directory to load the Jakarta Tomcat Connector <b>mod_jk</b> module. Add the following
lines at the end of the <tt>httpd.conf</tt> file.</p>

<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style:
solid;"><b>Excerpt from httpd.conf</b></div><div class="preformattedContent
panelContent">
<pre>LoadModule jk_module modules/mod_jk.so			
# Loads the Jakarta Tomcat Connector module

JkWorkersFile &lt;httpd_home&gt;\conf\workers.properties
# Tells the module the location of the workers.properties file

JkLogFile     &lt;httpd_home&gt;\logs\mod_jk.log
# Specifies the location for this module's specific log file

JkLogLevel    info
# Sets the module's log level to info

JkMount /console/* ajp13
# Sets a mount point from a context to a Tomcat worker. In this case will allow access (forward
the request) to the console.
</pre>
</div></div> 

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

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td>In this example, the
<b>console</b> has been enabled just for demonstration purposes. In a production
environment, you do not want to have the <b>console</b> accessible from the other
network (normally the Internet). Having the <b>console</b> accessible represents
a big security exposure.

<p>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.</p></td></tr></table></div>

<p><a href="#ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-top">Back
to Top</a></p>

<h1><a name="ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-Configureworkers.properties"></a>Configure
workers.properties</h1>
<p>The <tt>workers.properties</tt> 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.</p>

<p>Edit the <tt>workers.properties</tt> file located in the <tt>&lt;httpd_home&gt;\conf</tt>
directory to match your environment. The following example is an excerpt from the <tt>workers.properties</tt>
file with just the variables you should focus on.</p>

<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style:
solid;"><b>Minimum requirements for the workers.properties</b></div><div
class="preformattedContent panelContent">
<pre>worker.ajp13.type=ajp13
# Sets the version of AJP used. The AJP listeners defined in Geronimo are AJP v13.

worker.ajp13.host=localhost
# Specifies the location of the Geronimo server. Use default localhost for single-tier scenarios.
Specify the
# hostname of the Geronimo server for multi-tier environments.

worker.ajp13.port=8009
# Both Tomcat and Jetty come with a predefined AJP13 listener on port 8009
</pre>
</div></div>

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

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

<p><a href="#ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-top">Back
to Top</a></p>

<h1><a name="ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-Testing"></a>Testing</h1>
<p>For testing this configuration, make sure both Geronimo and HTTPd are up and running.
</p>

<ol>
	<li>Check Geronimo connectivity by accessing <a href="http://localhost:8080/console"
class="external-link" rel="nofollow">http://localhost:8080/console</a> , you should
see the Geronimo Administration Console.</li>
	<li>Check HTTPd connectivity by accessing <a href="http://localhost" class="external-link"
rel="nofollow">http://localhost</a> , you should see the Apache HTTPd welcome page.</li>
	<li>Check the HTTPd - Geronimo request forwarding by accessing <a href="http://localhost/console/"
class="external-link" rel="nofollow">http://localhost/console/</a> , 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 <b>Not Found</b> error triggered
by the Jakarta Tomcat Connector module.</li>
</ol>


<p><a href="#ConfigureApacheHTTPdwithJakartaTomcatConnector%28mod_jk%29-top">Back
to Top</a></p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Configure+Apache+HTTPd+with+Jakarta+Tomcat+Connector+%28mod_jk%29">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=20645305&revisedVersion=2&originalVersion=1">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Configure+Apache+HTTPd+with+Jakarta+Tomcat+Connector+%28mod_jk%29?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message