You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/03/25 22:49:53 UTC
svn commit: r1305124 [16/17] - in
/tomcat/site/trunk/docs/connectors-doc-archive: ./ jk2/ jk2/common/
jk2/common/printer/ jk2/images/ jk2/jk/ jk2/jk/printer/ jk2/jk2/
jk2/jk2/printer/ jk2/printer/
Added: tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/printer/vhosthowto.html
URL: http://svn.apache.org/viewvc/tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/printer/vhosthowto.html?rev=1305124&view=auto
==============================================================================
--- tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/printer/vhosthowto.html (added)
+++ tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/printer/vhosthowto.html Sun Mar 25 20:49:51 2012
@@ -0,0 +1,902 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html xmlns="http://www.w3.org/TR/xhtml1/strict">
+<head>
+<title>Apache 2.0.43 - Tomcat 4.1.12 - jk2 - virtual host HOWTO</title>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<meta content="1999-2004 The Apache Software Foundation" name="copyright"/>
+<meta content="Tue 22 Oct 2002 11:58:28 AM GMT-5" name="last-changed"/>
+<meta content="Umberto Nicoletti" name="author"/>
+<meta content="unicoletti at prometeo.it" name="email"/>
+<link href="..//style.css" type="text/css" rel="stylesheet"/>
+<link href="../images/tomcat.ico" rel="shortcut icon"/>
+</head>
+<body link="#525D76" vlink="#525D76" alink="#525D76" text="#000000" bgcolor="#ffffff">
+<a name="TOP"/>
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr height="1">
+<td class="nil" height="1" bgcolor="#ffffff" width="150">
+<img hspace="0" vspace="0" height="1" width="150" border="0" src="../images/pixel.gif"/>
+</td>
+<td class="nil" height="1" bgcolor="#ffffff" width="*">
+<img hspace="0" vspace="0" height="1" width="370" border="0" src="../images/pixel.gif"/>
+</td>
+</tr>
+<tr>
+<td width="*" colspan="2" class="logo" bgcolor="#ffffff">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left">
+<img align="left" height="48" width="505" border="0" src="../images/jakarta.gif"/>
+</td>
+<td align="right">
+<img align="right" border="0" src="../images/mod_jk.jpg"/>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+<td colspan="2" width="*" align="right" class="head" bgcolor="#999999">
+<nobr>
+<a href="http://www.apache.org/" class="head">Apache Software Foundation</a> |
+ <a href="http://jakarta.apache.org/" class="head">Jakarta Project</a> |
+ <a href="http://jakarta.apache.org/tomcat/" class="head">Apache Tomcat</a>
+</nobr>
+</td>
+</tr>
+<tr>
+<td class="body" valign="top" width="*" bgcolor="#ffffff">
+<table cellspacing="4" width="100%" border="0">
+<tr>
+<td nowrap="true" valign="top" align="left">
+<h2>Apache 2.0.43 - Tomcat 4.1.12 - jk2 - virtual host HOWTO</h2>
+</td>
+<td nowrap="true" valign="top" align="right">
+<img border="0" hspace="0" vspace="0" height="1" width="1" src="../images/void.gif"/>
+</td>
+</tr>
+</table>
+<a name="Scenario">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Scenario</td>
+</tr>
+</table>
+</a>
+<ul>
+<li>RedHat Linux 7.2</li>
+<li>Latest 1.4.x Sun JDK</li>
+<li>Tomcat 4.1.12 binary</li>
+<li>Apache 2.0.43 built from source</li>
+<li>jk2 connector binary from jakarta.apache.org</li>
+</ul>
+<br/>
+<a name="Requirements">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Requirements</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Deploy three (in my case) web applications under three different virtual hosts,
+making the default vhost
+respond to any name and to the bare IP address.
+</p>
+<br/>
+<a name="Installing JDK">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Installing JDK</td>
+</tr>
+</table>
+</a>
+<p class="section">Note: download the jdk, not just the jre!</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<div class="screen">
+Uncompress the jdk somewhere in the filesystem.
+I chose /usr/local/:
+</div>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+ll /usr/local/
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>
+drwxr-xr-x 9 root root 4096 Oct 18 16:37 j2sdk1.4.1_01
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>
+lrwxrwxrwx 1 root root 14 Oct 18 16:38 java -> j2sdk1.4.1_01/
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+make a symlink named java to j2sdk1.4.1_01/ so that you can
+easily switch back and forth
+between different jvms. We will use the same trick for apache and tomcat afterwards.
+</p>
+<p class="section">
+Now tell your bash shell where to find java binaries: create a file named java.sh in
+/etc/profile.d with the following content:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+cat /etc/profile.d/java.sh
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr># set java environment</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr/>
+</code>
+<br/>
+<code class="screen">
+<nobr>export JAVA_HOME=/usr/local/java</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>export PATH=$PATH:$JAVA_HOME/bin</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr/>
+</code>
+<br/>
+<code class="screen">
+<nobr>export CLASSPATH=$JAVA_HOME/lib</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+do a chmod:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<div class="screen">
+Make java.sh readable and executable by anyone:
+</div>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#chmod 755 /etc/profile.d/java.sh
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+which java
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>
+/usr/local/java/bin/java
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+You should get the answer given above. If not chek your environment and make
+sure that java.sh is executed
+when opening a new shell.
+Try to run a java program or the following: java -version.
+</p>
+<p class="section">
+If you don't like this way of installing java please ignore it.
+
+Make sure everything is ok and then jump to the next step.
+</p>
+<br/>
+<a name="Installing Apache">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Installing Apache</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Download the latest release, uncompress it, cd into the newly created directory
+and run the following:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+./configure -prefix=/usr/local/apache2.0.43 --sysconfdir=/etc/apache --localstatedir=/var --enable-so
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Of course you can customize the installation specifying other modules to enable
+or whatever you like.
+Just don't forget to ENABLE-SO, because that's what you need to load the
+apache-tomcat connector.
+</p>
+<p class="section">
+Run make and make install. Create the log directories and others (you can skip
+this if you know how
+to configure where apache puts its log files -> edit httpd.conf):
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#mkdir /var/logs
+</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#mkdir /usr/local/apache2.0.43/conf
+</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#mkdir /usr/local/apache2.0.43/logs
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Create the symlink /usr/local/apache to /usr/local/apache2.0.43 and test your
+installation
+by executing:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#/usr/local/apache/bin/apachectl start
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Open a browser and point it to the linux box: you should get a page telling you
+that the apache installation
+was successful.
+If that doesn't happen check the logs and troubleshoot: common errors in this configuration
+are that some directory holding log or configuration files is missing or maybe you have another web
+server listening on port 80.
+</p>
+<br/>
+<a name="Installing Tomcat">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Installing Tomcat</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Uncompress the tomcat binaries in a directory of your choice. In this howto we
+will use /opt.
+Create a symlink named jakarta to the newly created directory so that you have
+something like the following:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+ll /opt/
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>total 4</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>lrwxrwxrwx 1 root root 31 Oct 18 16:38 jakarta ->jakarta-tomcat-4.1.12-LE-jdk14/</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>drwxr-xr-x 12 root root 4096 Oct 18 18:10 jakarta-tomcat-4.1.12-LE-jdk14</nobr>
+</code>
+<br/>
+<div class="screen">
+Start tomcat by running:
+</div>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+/opt/jakarta/bin/startup.sh
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">After a
+few seconds point your browser at the IP of
+the linux box on port 8080 and you should see the tomcat welcome page.
+If not check the catalina.out log file in /opt/jakarta/logs and fix all errors
+until Tomcat comes up.
+</p>
+<br/>
+<a name="Configuring Tomcat to listen to Apache ajp13 requests">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Configuring Tomcat to listen to Apache ajp13 requests</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Here is a sample server.xml file. Please note that the location of directories
+and log files is absolutely
+arbitrary and you have to edit it to make it suit your needs.
+<pre class="section">
+<!-- Umberto Server Configuration File -->
+
+<Server port="8005" shutdown="SHUTDOWN" debug="0">
+ <!-- Define an Apache-Connector Service -->
+
+ <Service name="Tomcat-Apache">
+
+ <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
+ <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
+ port="8009" minProcessors="5" maxProcessors="75"
+ enableLookups="true" redirectPort="8443"
+ acceptCount="10" debug="0" connectionTimeout="20000"
+ useURIValidationHack="false"
+ protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
+
+ <Engine name="Apache" defaultHost="www.home.net" debug="0">
+
+ <Logger className="org.apache.catalina.logger.FileLogger"
+ prefix="apache_log." suffix=".txt"
+ timestamp="true"/>
+ <!-- Access log processes all requests for this virtual host. -->
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+
+ <Host name="www.home.net" debug="0"
+appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example"
+ unpackWARs="true" autoDeploy="true">
+ <Alias>localhost</Alias>
+ <Alias>www</Alias>
+ <Alias>10.0.0.10</Alias>
+
+
+ <Context path="" docBase="" debug="1"/>
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="home_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ </Host>
+
+ <Host name="www.customer1.it" debug="0"
+appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-blank"
+ unpackWARs="true" autoDeploy="true">
+
+ <Context path="" docBase="" debug="1"/>
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="cust1_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ </Host>
+
+ <Host name="www.customer2.net" debug="0"
+appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/root"
+ unpackWARs="true" autoDeploy="true">
+
+ <Context path="" docBase="" debug="1"/>
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="cust2_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ </Host>
+
+ </Engine>
+
+ </Service>
+
+</Server>
+</pre>
+
+This is a very minimalistic conf file, because we have taken away the HTTP1.1
+connector that allows us to talk directly to Tomcat.
+It might not be good for development, but it should be good for production.
+If you feel like you need also the Tomcat Standalone service then copy and paste
+it from your original server.xml file
+(you did back it up, didn't you?).
+<br/>
+Try to start tomcat again and check catalina.out to see if everything is up and
+running. If it complains about
+missing apr stuff try to edit /opt/jakarta/conf/jk2.properties and make it look so:
+
+<pre class="section">
+# list of needed handlers.
+handler.list=channelSocket,request
+# Override the default port for the channelSocket
+channelSocket.port=8009
+</pre>
+
+If everything is ok move on to next section.
+</p>
+<br/>
+<a name="Configuring Apache virtual hosting">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Configuring Apache virtual hosting</td>
+</tr>
+</table>
+</a>
+<p class="section">
+rtfm at <b>
+<a href="http://httpd.apache.org/docs-2.0/vhosts/">http://httpd.apache.org/docs-2.0/vhosts/</a>
+</b>
+In the appendix you can find the httpd.conf file I used to write and test this
+HOWTO.
+</p>
+<br/>
+<a name="Configuring Apache to talk to Tomcat">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Configuring Apache to talk to Tomcat</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Download the jk2 shared library for you version of apache and copy it in
+/usr/local/apache/modules
+(create the directory if necessary). If you can't find a suitable version of
+jk2 ask it to the tomcat-user mailing list
+or download the source and build it yourself (this is another HOWTO).
+</p>
+<p class="section">
+Create, if you haven't already, the /usr/local/apache/conf directory and create
+a file named
+workers2.properties with this content in it:
+
+<pre class="section">
+# only at beginnin. In production uncomment it out
+[logger.apache2]
+level=DEBUG
+
+[shm]
+file=/usr/local/apache/logs/shm.file
+size=1048576
+
+# Example socket channel, override port and host.
+[channel.socket:localhost:8009]
+port=8009
+host=127.0.0.1
+
+# define the worker
+[ajp13:localhost:8009]
+channel=channel.socket:localhost:8009
+
+# Uri mapping
+[uri:10.0.0.10/*.jsp]
+worker=ajp13:localhost:8009
+
+[uri:www.home.net/*.jsp]
+worker=ajp13:localhost:8009
+
+[uri:www.customer1.it/*.jsp]
+worker=ajp13:localhost:8009
+
+[uri:www.customer2.net/*.jsp]
+worker=ajp13:localhost:8009
+</pre>
+
+Edit the file, change ip addresses and names to suit your needs and save it.
+</p>
+<p class="section">
+Edit http.conf and add the following line in the Modules section:
+
+<pre class="section">
+LoadModule jk2_module modules/mod_jk2.so
+</pre>
+
+Save http.conf and try to start apache. It should now load the jk2 connector and
+the configuration
+from workers2.properties.
+Check the error log to make sure everything is ok.
+</p>
+<p class="section">
+Start tomcat and try to load a HTML page in your browser: apache should return
+the page
+without problems.
+Now try with a jsp page: it should display after a little.
+<br/>
+If you get errors check that the path and host names (double check also the
+configuration of DNS
+with your network administrator) are ok, the directories are readable by both
+Tomcat and Apache.
+Again look into the log files.
+</p>
+<p class="section">
+If everything works go to next section.
+</p>
+<br/>
+<a name="The last trick">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>The last trick</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Now ask your network administrator to set up an alias for your brand new server
+(use jspsrc if
+you like to stick to this howto).
+If you don't have easy access to dns try to edit your hosts file (on the client
+where you open the browser)
+and add a line as follows:
+
+<pre class="section">
+10.0.0.10 jspsrc
+</pre>
+
+where 10.0.0.10 is the ip of your server. Open your browser and type this in
+your location bar:
+
+<pre class="section">
+http://jspsrc
+</pre>
+
+and navigate to a jsp page. You should get the source of the jsp page into your
+browser!
+</p>
+<p class="section">
+This is clearly a security problem, if not a major annoyance.
+</p>
+<p class="section">
+What's wrong with the setup we came up so far? The problem is (or should be)
+that the ajp13
+connector can't find a virtual host that matches the jspsrc uri.
+What we need to do is set up the default virtual host so that ALL *.jsp requests
+get handled by tomcat.
+</p>
+<p class="section">
+How do we do it?
+</p>
+<p class="section">
+Read on if you want to know how.
+</p>
+<br/>
+<a name="JK directives in httpd.conf">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>JK directives in httpd.conf</td>
+</tr>
+</table>
+</a>
+<p class="section">
+In addition to the workers2.properties you can put Jk diretives directly into
+the httpd.conf file (just as you did
+with jk and webapp).
+Edit the default virtual host section in httpd.conf and add the following lines
+in the end, before
+<b class="code"></VirtualHost></b>:
+
+<pre class="section">
+ <Location "/*.jsp">
+ JkUriSet worker ajp13:localhost:8009
+ </Location>
+</pre>
+
+Restart Apache and test the jspsrc url again.
+</p>
+<p class="section">
+The jsp source should not be displayed anymore.
+</p>
+<br/>
+<a name="Notes">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Notes</td>
+</tr>
+</table>
+</a>
+<p class="section">
+I think a better approach would be to remove all uri directives from
+workers2.properties
+and to put them in http.conf as we did in the previous section for the defualt
+virtual host.
+Experiment and let me know.
+</p>
+<br/>
+<a name="APPENDIX A: httpd.conf">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>APPENDIX A: httpd.conf</td>
+</tr>
+</table>
+</a>
+<p class="section">
+<pre class="section">
+#
+# Umberto Nicoletti, 18/10/2002
+#
+
+### Section 1: Global Environment
+
+ServerRoot "/usr/local/apache"
+ErrorLog logs/error_log
+
+<IfModule !mpm_winnt.c>
+<IfModule !mpm_netware.c>
+#LockFile logs/accept.lock
+</IfModule>
+</IfModule>
+
+# ScoreBoardFile: File used to store internal server process information.
+<IfModule !mpm_netware.c>
+<IfModule !perchild.c>
+#ScoreBoardFile logs/apache_runtime_status
+</IfModule>
+</IfModule>
+
+<IfModule !mpm_netware.c>
+PidFile logs/httpd.pid
+</IfModule>
+
+Timeout 300
+
+KeepAlive On
+MaxKeepAliveRequests 100
+KeepAliveTimeout 15
+
+<IfModule prefork.c>
+StartServers 5
+MinSpareServers 5
+MaxSpareServers 10
+MaxClients 150
+MaxRequestsPerChild 0
+</IfModule>
+
+<IfModule worker.c>
+StartServers 2
+MaxClients 150
+MinSpareThreads 25
+MaxSpareThreads 75
+ThreadsPerChild 25
+MaxRequestsPerChild 0
+</IfModule>
+
+<IfModule perchild.c>
+NumServers 5
+StartThreads 5
+MinSpareThreads 5
+MaxSpareThreads 10
+MaxThreadsPerChild 20
+MaxRequestsPerChild 0
+</IfModule>
+
+# listen on all ports
+Listen 80
+
+#
+# Dynamic Shared Object (DSO) Support
+#
+LoadModule jk2_module modules/mod_jk2.so
+
+### Section 2: 'Main' server configuration
+
+<IfModule !mpm_winnt.c>
+<IfModule !mpm_netware.c>
+#
+# If you wish httpd to run as a different user or group, you must run
+# httpd as root initially and it will switch.
+#
+# User/Group: The name (or #number) of the user/group to run httpd as.
+# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
+# . On HPUX you may not be able to use shared memory as nobody, and the
+# suggested workaround is to create a user www and use that user.
+# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
+# when the value of (unsigned)Group is above 60000;
+# don't use Group #-1 on these systems!
+#
+User nobody
+Group #-1
+</IfModule>
+</IfModule>
+
+ServerAdmin whatever@you.want
+ServerName www.home.net
+UseCanonicalName Off
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+LogLevel debug
+CustomLog logs/access.log common
+
+DocumentRoot "/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example"
+
+<Directory /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example>
+ Options None
+ AllowOverride None
+</Directory>
+
+DirectoryIndex index.html index.jsp
+
+<Directory />
+ Options None
+ AllowOverride None
+</Directory>
+
+<Files ~ "^\.ht">
+ Order allow,deny
+ Deny from all
+</Files>
+
+<Location /WEB-INF/>
+ Order Allow,Deny
+</Location>
+
+NameVirtualHost *
+
+<VirtualHost *>
+ ServerName www.home.net
+ ServerAlias www
+ ServerAlias localhost
+ ServerAdmin sysmaster@arpa.veneto.it
+ DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example
+
+ ErrorLog logs/home.net-errorlog
+ CustomLog logs/home.net-access.log common
+
+ <Location "/*.jsp">
+ JkUriSet worker ajp13:localhost:8009
+ </Location>
+</VirtualHost>
+
+<VirtualHost *>
+ ServerName www.customer1.it
+ ServerAdmin sysmaster@arpa.veneto.it
+ DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-blank
+ ErrorLog logs/cust1-errorlog
+</VirtualHost>
+
+<VirtualHost *>
+ ServerName www.customer2.net
+ ServerAdmin sysmaster@arpa.veneto.it
+ DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/root
+ ErrorLog logs/cust2-errorlog
+</VirtualHost>
+</pre>
+</p>
+<br/>
+</td>
+</tr>
+</table>
+</body>
+</html>
Propchange: tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/printer/vhosthowto.html
------------------------------------------------------------------------------
svn:executable = *
Added: tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/vhosthowto.html
URL: http://svn.apache.org/viewvc/tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/vhosthowto.html?rev=1305124&view=auto
==============================================================================
--- tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/vhosthowto.html (added)
+++ tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/vhosthowto.html Sun Mar 25 20:49:51 2012
@@ -0,0 +1,1211 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html xmlns="http://www.w3.org/TR/xhtml1/strict">
+<head>
+<title>Apache 2.0.43 - Tomcat 4.1.12 - jk2 - virtual host HOWTO</title>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<meta content="1999-2004 The Apache Software Foundation" name="copyright"/>
+<meta content="Tue 22 Oct 2002 11:58:28 AM GMT-5" name="last-changed"/>
+<meta content="Umberto Nicoletti" name="author"/>
+<meta content="unicoletti at prometeo.it" name="email"/>
+<link href="..//style.css" type="text/css" rel="stylesheet"/>
+<link href="../images/tomcat.ico" rel="shortcut icon"/>
+</head>
+<body link="#525D76" vlink="#525D76" alink="#525D76" text="#000000" bgcolor="#ffffff">
+<a name="TOP"/>
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr height="1">
+<td class="nil" height="1" bgcolor="#ffffff" width="150">
+<img hspace="0" vspace="0" height="1" width="150" border="0" src="../images/pixel.gif"/>
+</td>
+<td class="nil" height="1" bgcolor="#ffffff" width="*">
+<img hspace="0" vspace="0" height="1" width="370" border="0" src="../images/pixel.gif"/>
+</td>
+</tr>
+<tr>
+<td width="*" colspan="2" class="logo" bgcolor="#ffffff">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left">
+<img align="left" height="48" width="505" border="0" src="../images/jakarta.gif"/>
+</td>
+<td align="right">
+<img align="right" border="0" src="../images/mod_jk.jpg"/>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+<td colspan="2" width="*" align="right" class="head" bgcolor="#999999">
+<nobr>
+<a href="http://www.apache.org/" class="head">Apache Software Foundation</a> |
+ <a href="http://jakarta.apache.org/" class="head">Jakarta Project</a> |
+ <a href="http://jakarta.apache.org/tomcat/" class="head">Apache Tomcat</a>
+</nobr>
+</td>
+</tr>
+<tr>
+<td valign="top" width="150" bgcolor="#ffffff">
+<table class="menu" cellpadding="0" cellspacing="0" width="150" border="0">
+<tr height="1">
+<td class="nil" height="1" bgcolor="#cccccc" width="10">
+<img hspace="0" vspace="0" height="1" width="10" border="0" src="../images/pixel.gif"/>
+</td>
+<td class="nil" height="1" bgcolor="#cccccc" width="140">
+<img hspace="0" vspace="0" height="1" width="140" border="0" src="../images/pixel.gif"/>
+</td>
+</tr>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">Presentation</td>
+</tr>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../index.html">Overview</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr height="6"/>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">Commons</td>
+</tr>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../common/AJPv13.html">AJPv13</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../common/AJPv13-extensions-proposal.html">AJPv13 extensions Proposal</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../common/doccontrib.html">How to Contribute to the Documentation</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../common/tools.html">Tools</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../faq.html">FAQ</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr height="6"/>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">JK</td>
+</tr>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk/quickhowto.html">Quick Start HowTo</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk/aphowto.html">Apache HowTo</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk/domhowto.html">Domino HowTo</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk/iishowto.html">IIS HowTo</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk/neshowto.html">Netscape/iPlanet HowTo</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk/workershowto.html">Workers HowTo</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr height="6"/>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">JK2</td>
+</tr>
+<tr height="6"/>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">Configuration in the Tomcat</td>
+</tr>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/configtc.html">Configuration options</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/configtccom.html">Coyote/JK2 Handlers</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/configtcex.html">Examples</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr height="6"/>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">Configuration in the Web Server</td>
+</tr>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/configweb.html">Configuration file</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/configwebcom.html">Components</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/configwebex.html">Examples</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr height="6"/>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">Installation</td>
+</tr>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/installhowto.html">Installation of jk2 in the Web Server</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr height="6"/>
+<tr height="6">
+<td colspan="2" width="150" bgcolor="#d0d0d0">Howto</td>
+</tr>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/confighowto.html">Quick Start JK2 Configuration Guide</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/vhosthowto.html">Apache 2.0.43 - Tomcat 4.1.12 - jk2 - virtual host HOWTO</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Scenario" class="menu">Scenario</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Requirements" class="menu">Requirements</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Installing JDK" class="menu">Installing JDK</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Installing Apache" class="menu">Installing Apache</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Installing Tomcat" class="menu">Installing Tomcat</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Configuring Tomcat to listen to Apache ajp13 requests" class="menu">Configuring Tomcat to listen to Apache ajp13 requests</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Configuring Apache virtual hosting" class="menu">Configuring Apache virtual hosting</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Configuring Apache to talk to Tomcat" class="menu">Configuring Apache to talk to Tomcat</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#The last trick" class="menu">The last trick</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#JK directives in httpd.conf" class="menu">JK directives in httpd.conf</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#Notes" class="menu">Notes</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td width="10" bgcolor="#cccccc"/>
+<td width="140" bgcolor="#cccccc">
+<a href="#APPENDIX A: httpd.conf" class="menu">APPENDIX A: httpd.conf</a>
+</td>
+</tr>
+<tr height="1"/>
+<tr>
+<td colspan="2" width="150" bgcolor="#cccccc">
+<nobr>
+<a class="menu" href="../jk2/davhowto.html">Apache 2.x/mod-dav - Tomcat/jk2 - HOWTO</a>
+</nobr>
+</td>
+</tr>
+<tr height="2"/>
+<tr height="6"/>
+</table>
+</td>
+<td class="body" valign="top" width="*" bgcolor="#ffffff">
+<table cellspacing="4" width="100%" border="0">
+<tr>
+<td nowrap="true" valign="top" align="left">
+<h2>Apache 2.0.43 - Tomcat 4.1.12 - jk2 - virtual host HOWTO</h2>
+</td>
+<td nowrap="true" valign="top" align="right">
+<small>
+<a href="../jk2/printer/vhosthowto.html">
+<img alt="Printer Friendly Version" border="0" src="../images/printer.gif"/>
+<br/>print-friendly<br/>version
+ </a>
+</small>
+</td>
+</tr>
+</table>
+<a name="Scenario">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Scenario</td>
+</tr>
+</table>
+</a>
+<ul>
+<li>RedHat Linux 7.2</li>
+<li>Latest 1.4.x Sun JDK</li>
+<li>Tomcat 4.1.12 binary</li>
+<li>Apache 2.0.43 built from source</li>
+<li>jk2 connector binary from jakarta.apache.org</li>
+</ul>
+<br/>
+<a name="Requirements">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Requirements</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Deploy three (in my case) web applications under three different virtual hosts,
+making the default vhost
+respond to any name and to the bare IP address.
+</p>
+<br/>
+<a name="Installing JDK">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Installing JDK</td>
+</tr>
+</table>
+</a>
+<p class="section">Note: download the jdk, not just the jre!</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<div class="screen">
+Uncompress the jdk somewhere in the filesystem.
+I chose /usr/local/:
+</div>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+ll /usr/local/
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>
+drwxr-xr-x 9 root root 4096 Oct 18 16:37 j2sdk1.4.1_01
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>
+lrwxrwxrwx 1 root root 14 Oct 18 16:38 java -> j2sdk1.4.1_01/
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+make a symlink named java to j2sdk1.4.1_01/ so that you can
+easily switch back and forth
+between different jvms. We will use the same trick for apache and tomcat afterwards.
+</p>
+<p class="section">
+Now tell your bash shell where to find java binaries: create a file named java.sh in
+/etc/profile.d with the following content:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+cat /etc/profile.d/java.sh
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr># set java environment</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr/>
+</code>
+<br/>
+<code class="screen">
+<nobr>export JAVA_HOME=/usr/local/java</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>export PATH=$PATH:$JAVA_HOME/bin</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr/>
+</code>
+<br/>
+<code class="screen">
+<nobr>export CLASSPATH=$JAVA_HOME/lib</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+do a chmod:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<div class="screen">
+Make java.sh readable and executable by anyone:
+</div>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#chmod 755 /etc/profile.d/java.sh
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+which java
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>
+/usr/local/java/bin/java
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+You should get the answer given above. If not chek your environment and make
+sure that java.sh is executed
+when opening a new shell.
+Try to run a java program or the following: java -version.
+</p>
+<p class="section">
+If you don't like this way of installing java please ignore it.
+
+Make sure everything is ok and then jump to the next step.
+</p>
+<br/>
+<a name="Installing Apache">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Installing Apache</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Download the latest release, uncompress it, cd into the newly created directory
+and run the following:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+./configure -prefix=/usr/local/apache2.0.43 --sysconfdir=/etc/apache --localstatedir=/var --enable-so
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Of course you can customize the installation specifying other modules to enable
+or whatever you like.
+Just don't forget to ENABLE-SO, because that's what you need to load the
+apache-tomcat connector.
+</p>
+<p class="section">
+Run make and make install. Create the log directories and others (you can skip
+this if you know how
+to configure where apache puts its log files -> edit httpd.conf):
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#mkdir /var/logs
+</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#mkdir /usr/local/apache2.0.43/conf
+</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#mkdir /usr/local/apache2.0.43/logs
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Create the symlink /usr/local/apache to /usr/local/apache2.0.43 and test your
+installation
+by executing:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+#/usr/local/apache/bin/apachectl start
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Open a browser and point it to the linux box: you should get a page telling you
+that the apache installation
+was successful.
+If that doesn't happen check the logs and troubleshoot: common errors in this configuration
+are that some directory holding log or configuration files is missing or maybe you have another web
+server listening on port 80.
+</p>
+<br/>
+<a name="Installing Tomcat">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Installing Tomcat</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Uncompress the tomcat binaries in a directory of your choice. In this howto we
+will use /opt.
+Create a symlink named jakarta to the newly created directory so that you have
+something like the following:
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+ll /opt/
+</b>
+</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>total 4</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>lrwxrwxrwx 1 root root 31 Oct 18 16:38 jakarta ->jakarta-tomcat-4.1.12-LE-jdk14/</nobr>
+</code>
+<br/>
+<code class="screen">
+<nobr>drwxr-xr-x 12 root root 4096 Oct 18 18:10 jakarta-tomcat-4.1.12-LE-jdk14</nobr>
+</code>
+<br/>
+<div class="screen">
+Start tomcat by running:
+</div>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">
+/opt/jakarta/bin/startup.sh
+</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">After a
+few seconds point your browser at the IP of
+the linux box on port 8080 and you should see the tomcat welcome page.
+If not check the catalina.out log file in /opt/jakarta/logs and fix all errors
+until Tomcat comes up.
+</p>
+<br/>
+<a name="Configuring Tomcat to listen to Apache ajp13 requests">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Configuring Tomcat to listen to Apache ajp13 requests</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Here is a sample server.xml file. Please note that the location of directories
+and log files is absolutely
+arbitrary and you have to edit it to make it suit your needs.
+<pre class="section">
+<!-- Umberto Server Configuration File -->
+
+<Server port="8005" shutdown="SHUTDOWN" debug="0">
+ <!-- Define an Apache-Connector Service -->
+
+ <Service name="Tomcat-Apache">
+
+ <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
+ <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
+ port="8009" minProcessors="5" maxProcessors="75"
+ enableLookups="true" redirectPort="8443"
+ acceptCount="10" debug="0" connectionTimeout="20000"
+ useURIValidationHack="false"
+ protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
+
+ <Engine name="Apache" defaultHost="www.home.net" debug="0">
+
+ <Logger className="org.apache.catalina.logger.FileLogger"
+ prefix="apache_log." suffix=".txt"
+ timestamp="true"/>
+ <!-- Access log processes all requests for this virtual host. -->
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="localhost_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+
+ <Host name="www.home.net" debug="0"
+appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example"
+ unpackWARs="true" autoDeploy="true">
+ <Alias>localhost</Alias>
+ <Alias>www</Alias>
+ <Alias>10.0.0.10</Alias>
+
+
+ <Context path="" docBase="" debug="1"/>
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="home_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ </Host>
+
+ <Host name="www.customer1.it" debug="0"
+appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-blank"
+ unpackWARs="true" autoDeploy="true">
+
+ <Context path="" docBase="" debug="1"/>
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="cust1_access_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ </Host>
+
+ <Host name="www.customer2.net" debug="0"
+appBase="/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/root"
+ unpackWARs="true" autoDeploy="true">
+
+ <Context path="" docBase="" debug="1"/>
+
+ <Valve className="org.apache.catalina.valves.AccessLogValve"
+ directory="logs" prefix="cust2_log." suffix=".txt"
+ pattern="common" resolveHosts="false"/>
+ </Host>
+
+ </Engine>
+
+ </Service>
+
+</Server>
+</pre>
+
+This is a very minimalistic conf file, because we have taken away the HTTP1.1
+connector that allows us to talk directly to Tomcat.
+It might not be good for development, but it should be good for production.
+If you feel like you need also the Tomcat Standalone service then copy and paste
+it from your original server.xml file
+(you did back it up, didn't you?).
+<br/>
+Try to start tomcat again and check catalina.out to see if everything is up and
+running. If it complains about
+missing apr stuff try to edit /opt/jakarta/conf/jk2.properties and make it look so:
+
+<pre class="section">
+# list of needed handlers.
+handler.list=channelSocket,request
+# Override the default port for the channelSocket
+channelSocket.port=8009
+</pre>
+
+If everything is ok move on to next section.
+</p>
+<br/>
+<a name="Configuring Apache virtual hosting">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Configuring Apache virtual hosting</td>
+</tr>
+</table>
+</a>
+<p class="section">
+rtfm at <b>
+<a href="http://httpd.apache.org/docs-2.0/vhosts/">http://httpd.apache.org/docs-2.0/vhosts/</a>
+</b>
+In the appendix you can find the httpd.conf file I used to write and test this
+HOWTO.
+</p>
+<br/>
+<a name="Configuring Apache to talk to Tomcat">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Configuring Apache to talk to Tomcat</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Download the jk2 shared library for you version of apache and copy it in
+/usr/local/apache/modules
+(create the directory if necessary). If you can't find a suitable version of
+jk2 ask it to the tomcat-user mailing list
+or download the source and build it yourself (this is another HOWTO).
+</p>
+<p class="section">
+Create, if you haven't already, the /usr/local/apache/conf directory and create
+a file named
+workers2.properties with this content in it:
+
+<pre class="section">
+# only at beginnin. In production uncomment it out
+[logger.apache2]
+level=DEBUG
+
+[shm]
+file=/usr/local/apache/logs/shm.file
+size=1048576
+
+# Example socket channel, override port and host.
+[channel.socket:localhost:8009]
+port=8009
+host=127.0.0.1
+
+# define the worker
+[ajp13:localhost:8009]
+channel=channel.socket:localhost:8009
+
+# Uri mapping
+[uri:10.0.0.10/*.jsp]
+worker=ajp13:localhost:8009
+
+[uri:www.home.net/*.jsp]
+worker=ajp13:localhost:8009
+
+[uri:www.customer1.it/*.jsp]
+worker=ajp13:localhost:8009
+
+[uri:www.customer2.net/*.jsp]
+worker=ajp13:localhost:8009
+</pre>
+
+Edit the file, change ip addresses and names to suit your needs and save it.
+</p>
+<p class="section">
+Edit http.conf and add the following line in the Modules section:
+
+<pre class="section">
+LoadModule jk2_module modules/mod_jk2.so
+</pre>
+
+Save http.conf and try to start apache. It should now load the jk2 connector and
+the configuration
+from workers2.properties.
+Check the error log to make sure everything is ok.
+</p>
+<p class="section">
+Start tomcat and try to load a HTML page in your browser: apache should return
+the page
+without problems.
+Now try with a jsp page: it should display after a little.
+<br/>
+If you get errors check that the path and host names (double check also the
+configuration of DNS
+with your network administrator) are ok, the directories are readable by both
+Tomcat and Apache.
+Again look into the log files.
+</p>
+<p class="section">
+If everything works go to next section.
+</p>
+<br/>
+<a name="The last trick">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>The last trick</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Now ask your network administrator to set up an alias for your brand new server
+(use jspsrc if
+you like to stick to this howto).
+If you don't have easy access to dns try to edit your hosts file (on the client
+where you open the browser)
+and add a line as follows:
+
+<pre class="section">
+10.0.0.10 jspsrc
+</pre>
+
+where 10.0.0.10 is the ip of your server. Open your browser and type this in
+your location bar:
+
+<pre class="section">
+http://jspsrc
+</pre>
+
+and navigate to a jsp page. You should get the source of the jsp page into your
+browser!
+</p>
+<p class="section">
+This is clearly a security problem, if not a major annoyance.
+</p>
+<p class="section">
+What's wrong with the setup we came up so far? The problem is (or should be)
+that the ajp13
+connector can't find a virtual host that matches the jspsrc uri.
+What we need to do is set up the default virtual host so that ALL *.jsp requests
+get handled by tomcat.
+</p>
+<p class="section">
+How do we do it?
+</p>
+<p class="section">
+Read on if you want to know how.
+</p>
+<br/>
+<a name="JK directives in httpd.conf">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>JK directives in httpd.conf</td>
+</tr>
+</table>
+</a>
+<p class="section">
+In addition to the workers2.properties you can put Jk diretives directly into
+the httpd.conf file (just as you did
+with jk and webapp).
+Edit the default virtual host section in httpd.conf and add the following lines
+in the end, before
+<b class="code"></VirtualHost></b>:
+
+<pre class="section">
+ <Location "/*.jsp">
+ JkUriSet worker ajp13:localhost:8009
+ </Location>
+</pre>
+
+Restart Apache and test the jspsrc url again.
+</p>
+<p class="section">
+The jsp source should not be displayed anymore.
+</p>
+<br/>
+<a name="Notes">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>Notes</td>
+</tr>
+</table>
+</a>
+<p class="section">
+I think a better approach would be to remove all uri directives from
+workers2.properties
+and to put them in http.conf as we did in the previous section for the defualt
+virtual host.
+Experiment and let me know.
+</p>
+<br/>
+<a name="APPENDIX A: httpd.conf">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="../images/corner.gif"/>APPENDIX A: httpd.conf</td>
+</tr>
+</table>
+</a>
+<p class="section">
+<pre class="section">
+#
+# Umberto Nicoletti, 18/10/2002
+#
+
+### Section 1: Global Environment
+
+ServerRoot "/usr/local/apache"
+ErrorLog logs/error_log
+
+<IfModule !mpm_winnt.c>
+<IfModule !mpm_netware.c>
+#LockFile logs/accept.lock
+</IfModule>
+</IfModule>
+
+# ScoreBoardFile: File used to store internal server process information.
+<IfModule !mpm_netware.c>
+<IfModule !perchild.c>
+#ScoreBoardFile logs/apache_runtime_status
+</IfModule>
+</IfModule>
+
+<IfModule !mpm_netware.c>
+PidFile logs/httpd.pid
+</IfModule>
+
+Timeout 300
+
+KeepAlive On
+MaxKeepAliveRequests 100
+KeepAliveTimeout 15
+
+<IfModule prefork.c>
+StartServers 5
+MinSpareServers 5
+MaxSpareServers 10
+MaxClients 150
+MaxRequestsPerChild 0
+</IfModule>
+
+<IfModule worker.c>
+StartServers 2
+MaxClients 150
+MinSpareThreads 25
+MaxSpareThreads 75
+ThreadsPerChild 25
+MaxRequestsPerChild 0
+</IfModule>
+
+<IfModule perchild.c>
+NumServers 5
+StartThreads 5
+MinSpareThreads 5
+MaxSpareThreads 10
+MaxThreadsPerChild 20
+MaxRequestsPerChild 0
+</IfModule>
+
+# listen on all ports
+Listen 80
+
+#
+# Dynamic Shared Object (DSO) Support
+#
+LoadModule jk2_module modules/mod_jk2.so
+
+### Section 2: 'Main' server configuration
+
+<IfModule !mpm_winnt.c>
+<IfModule !mpm_netware.c>
+#
+# If you wish httpd to run as a different user or group, you must run
+# httpd as root initially and it will switch.
+#
+# User/Group: The name (or #number) of the user/group to run httpd as.
+# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
+# . On HPUX you may not be able to use shared memory as nobody, and the
+# suggested workaround is to create a user www and use that user.
+# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
+# when the value of (unsigned)Group is above 60000;
+# don't use Group #-1 on these systems!
+#
+User nobody
+Group #-1
+</IfModule>
+</IfModule>
+
+ServerAdmin whatever@you.want
+ServerName www.home.net
+UseCanonicalName Off
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+
+LogLevel debug
+CustomLog logs/access.log common
+
+DocumentRoot "/opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example"
+
+<Directory /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example>
+ Options None
+ AllowOverride None
+</Directory>
+
+DirectoryIndex index.html index.jsp
+
+<Directory />
+ Options None
+ AllowOverride None
+</Directory>
+
+<Files ~ "^\.ht">
+ Order allow,deny
+ Deny from all
+</Files>
+
+<Location /WEB-INF/>
+ Order Allow,Deny
+</Location>
+
+NameVirtualHost *
+
+<VirtualHost *>
+ ServerName www.home.net
+ ServerAlias www
+ ServerAlias localhost
+ ServerAdmin sysmaster@arpa.veneto.it
+ DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-example
+
+ ErrorLog logs/home.net-errorlog
+ CustomLog logs/home.net-access.log common
+
+ <Location "/*.jsp">
+ JkUriSet worker ajp13:localhost:8009
+ </Location>
+</VirtualHost>
+
+<VirtualHost *>
+ ServerName www.customer1.it
+ ServerAdmin sysmaster@arpa.veneto.it
+ DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/struts-blank
+ ErrorLog logs/cust1-errorlog
+</VirtualHost>
+
+<VirtualHost *>
+ ServerName www.customer2.net
+ ServerAdmin sysmaster@arpa.veneto.it
+ DocumentRoot /opt/jakarta-tomcat-4.1.12-LE-jdk14/webapps/root
+ ErrorLog logs/cust2-errorlog
+</VirtualHost>
+</pre>
+</p>
+<br/>
+</td>
+</tr>
+</table>
+</body>
+</html>
Propchange: tomcat/site/trunk/docs/connectors-doc-archive/jk2/jk2/vhosthowto.html
------------------------------------------------------------------------------
svn:executable = *
Added: tomcat/site/trunk/docs/connectors-doc-archive/jk2/printer/faq.html
URL: http://svn.apache.org/viewvc/tomcat/site/trunk/docs/connectors-doc-archive/jk2/printer/faq.html?rev=1305124&view=auto
==============================================================================
--- tomcat/site/trunk/docs/connectors-doc-archive/jk2/printer/faq.html (added)
+++ tomcat/site/trunk/docs/connectors-doc-archive/jk2/printer/faq.html Sun Mar 25 20:49:51 2012
@@ -0,0 +1,664 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html xmlns="http://www.w3.org/TR/xhtml1/strict">
+<head>
+<title>FAQ</title>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<meta content="1999-2004 The Apache Software Foundation" name="copyright"/>
+<meta content="$Date: 2004/03/04 04:46:33 $" name="last-changed"/>
+<meta content="Henri Gomez" name="author"/>
+<meta content="hgomez@apache.org" name="email"/>
+<link href="./style.css" type="text/css" rel="stylesheet"/>
+<link href="images/tomcat.ico" rel="shortcut icon"/>
+</head>
+<body link="#525D76" vlink="#525D76" alink="#525D76" text="#000000" bgcolor="#ffffff">
+<a name="TOP"/>
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr height="1">
+<td class="nil" height="1" bgcolor="#ffffff" width="150">
+<img hspace="0" vspace="0" height="1" width="150" border="0" src="images/pixel.gif"/>
+</td>
+<td class="nil" height="1" bgcolor="#ffffff" width="*">
+<img hspace="0" vspace="0" height="1" width="370" border="0" src="images/pixel.gif"/>
+</td>
+</tr>
+<tr>
+<td width="*" colspan="2" class="logo" bgcolor="#ffffff">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left">
+<img align="left" height="48" width="505" border="0" src="images/jakarta.gif"/>
+</td>
+<td align="right">
+<img align="right" border="0" src="images/mod_jk.jpg"/>
+</td>
+</tr>
+</table>
+</td>
+</tr>
+<tr>
+<td colspan="2" width="*" align="right" class="head" bgcolor="#999999">
+<nobr>
+<a href="http://www.apache.org/" class="head">Apache Software Foundation</a> |
+ <a href="http://jakarta.apache.org/" class="head">Jakarta Project</a> |
+ <a href="http://jakarta.apache.org/tomcat/" class="head">Apache Tomcat</a>
+</nobr>
+</td>
+</tr>
+<tr>
+<td class="body" valign="top" width="*" bgcolor="#ffffff">
+<table cellspacing="4" width="100%" border="0">
+<tr>
+<td nowrap="true" valign="top" align="left">
+<h2>FAQ</h2>
+</td>
+<td nowrap="true" valign="top" align="right">
+<img border="0" hspace="0" vspace="0" height="1" width="1" src="images/void.gif"/>
+</td>
+</tr>
+</table>
+<a name="General">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>General</td>
+</tr>
+</table>
+</a>
+<p class="section">
+General Informations and FAQ about JK
+</p>
+<a name="sub_Where can I get help/support for JK ?">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Where can I get help/support for JK ?</td>
+</tr>
+</table>
+</a>
+<p class="section">
+The primary mechanism for support is through the JK
+documentation included in the doc directory.
+Documentation is also available on the Apache Jakarta web site devoted to the
+<b>
+<a href="http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/index.html">
+Jakarta Tomcat Connectors Project</a>
+</b>
+For additional help, the best resource is the Tomcat Users Discussion list.
+You should start by searching
+<b>
+<a href="http://mikal.org/interests/java/tomcat/index.html">
+the mail list archive</a>
+</b>
+before you post questions to the list.
+If you are unable to locate the answer to your question in the archive,
+you can post questions about JK to the user list for assistance.
+Make sure that you include the version of your Webserver,
+that you are using as well as the platform you are running on
+and go
+<b>
+<a href="http://jakarta.apache.org/site/mail.html">
+here</a>
+</b>
+to determine how to subscribe to tomcat mailing list.
+</p>
+<br/>
+<a name="sub_I can't find JK anywhere. Where is it?">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>I can't find JK anywhere. Where is it?</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Now that JK moved to the <b>
+<font color="#333333">jakarta-tomcat-connectors</font>
+</b> repository,
+the source for JK can be downloaded from a mirror at the
+<b>
+<a href="http://jakarta.apache.org/site/sourceindex.cgi">
+Jakarta Source Download</a>
+</b> page and the binaries for JK can
+be downloaded from a mirror at the
+<b>
+<a href="http://jakarta.apache.org/site/binindex.cgi">
+Jakarta Binary Download</a>
+</b> page.
+</p>
+<br/>
+<a name="sub_What's the difference between JK and mod_jk ?">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>What's the difference between JK and mod_jk ?</td>
+</tr>
+</table>
+</a>
+<p class="section">
+<b>
+<font color="#333333">JK</font>
+</b> is a project covering web-servers to Tomcat connectors,
+whereas <b>
+<font color="#333333">mod_jk</font>
+</b> is the <b>
+<a href="jk/aphowto.html">Apache module</a>
+</b> developped in JK.
+</p>
+<p class="section">
+<b>
+<a href="jk/domhowto.html">Domino webserver</a>
+</b> support is implemented on JK, using a redirector
+called <b>
+<font color="#333333">dsapi redirector</font>
+</b>.
+</p>
+<p class="section">
+<b>
+<a href="jk/iishowto.html">IIS webserver</a>
+</b>support is implemented on JK, using a redirector
+called <b>
+<font color="#333333">isapi redirector</font>
+</b>.
+</p>
+<p class="section">
+<b>
+<a href="jk/neshowto.html">Netscape/iPlanet webserver</a>
+</b>webserver support is implemented on JK, using a redirector
+called <b>
+<font color="#333333">nsapi redirector</font>
+</b>.
+</p>
+<br/>
+<a name="sub_Where can I get more information ?">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Where can I get more information ?</td>
+</tr>
+</table>
+</a>
+<p class="section">
+For <b>
+<font color="#333333">JK 1.2.x</font>
+</b>, you should read :
+</p>
+<ul>
+<li>
+<b>
+<a href="jk/quickhowto.html">For the impatients</a>
+</b>
+</li>
+<li>
+<b>
+<a href="jk/aphowto.html">Apache and JK</a>
+</b>
+</li>
+<li>
+<b>
+<a href="jk/domhowto.html">Domino and JK</a>
+</b>
+</li>
+<li>
+<b>
+<a href="jk/iishowto.html">IIS and JK</a>
+</b>
+</li>
+<li>
+<b>
+<a href="jk/neshowto.html">Netscape/iPlanet and JK</a>
+</b>
+</li>
+<li>
+<b>
+<a href="jk/workershowto.html">Workers configuration</a>
+</b>
+</li>
+</ul>
+<p class="section">
+For <b>
+<font color="#333333">JK 2.0.x</font>
+</b> the <b>
+<a href="jk2/configtc.html">
+config tomcat</a>
+</b> and <b>
+<a href="jk2/configweb.html">config webserver</a>
+</b>
+documents have considerably more in-depth information.
+It's worth a look.
+You could also try searching the mailing list archives for "JK" or look at the source.
+</p>
+<br/>
+<a name="sub_Which protocol should I use? Ajp12 or Ajp13?">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Which protocol should I use? Ajp12 or Ajp13?</td>
+</tr>
+</table>
+</a>
+<p class="section">
+<b>
+<a href="common/AJPv13.html">Ajp13</a>
+</b> is a newer protocol, it's faster, and it works better with SSL.
+You almost certainly want to use it now that ajp12 is deprecated.
+</p>
+<p class="section">
+Also ajp13 is supported by all Apache Tomcat including 3.2.x , 3.3.x, 4.0.x, 4.1.x and the new tomcat 5.
+</p>
+<p class="section">
+Others Servlet engines like <b>
+<font color="#333333">jetty</font>
+</b> have support for Ajp13.
+</p>
+<br/>
+<a name="sub_I've got a firewall between my WebServer and Tomcat who drop ajp13 connections after some times">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>I've got a firewall between my WebServer and Tomcat who drop ajp13 connections after some times</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Ajp13 use persistant connections where the traffic could be null if there is no request to be sent to Tomcat.
+Firewall used to drop inactive connections and will make your WebServer and Tomcat think the connection is valid.
+</p>
+<p class="section">
+Starting with JK 1.2.0, a <b>
+<font color="#333333">socket_keepalive</font>
+</b> property as been added to ajp13 settings, and you should take a look at
+it in <b>
+<a href="jk/workershowto.html">Workers HowTo</a>
+</b>.
+</p>
+<br/>
+<a name="sub_Under heavy load, I've got many threads in Tomcat even if my Apache Web Server handle much of the load">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Under heavy load, I've got many threads in Tomcat even if my Apache Web Server handle much of the load</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Under heavy load, Apache WebServer create many childs to handle the load, which will in turn create many connections
+to Tomcat to forward the requests they should handle.
+Apache WebServer will normally kill the childs/threads when the load decrease. But if the load is still there and
+even if only Apache handle the requests, ie static contents, the childs are kept and with them the ajp13 connections,
+even if they are no more used.
+</p>
+<p class="section">
+Since JK 1.2.0, <b>
+<font color="#333333">cache_timeout</font>
+</b> and <b>
+<font color="#333333">socket_timeout</font>
+</b> properties as been added to close
+connections after some time of inactivity, for more informations refer to <b>
+<a href="jk/workershowto.html">Workers HowTo</a>
+</b>.
+</p>
+<br/>
+<br/>
+<a name="Apache">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Apache</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Informations and FAQ about mod_jk and Apache Web Servers.
+</p>
+<a name="sub_Whenever I restart Tomcat, Apache locks up!">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Whenever I restart Tomcat, Apache locks up!</td>
+</tr>
+</table>
+</a>
+<p class="section">
+The Ajp13 protocol keeps an open socket between Tomcat and Apache. Release of mod_jk present in J-T-C handle the network failure.
+But with previous release of mod_jk, you may have to restart Apache as well.
+</p>
+<br/>
+<a name="sub_Why did exist two files mod_jk.so (-eapi ad -noeapi) in download dir for Linux ?">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Why did exist two files mod_jk.so (-eapi ad -noeapi) in download dir for Linux ?</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Many versions of Apache use of modified API, known at Extended API, developped for use with the
+<b>
+<a href="http://www.modssl.org">mod_ssl module</a>
+</b>.
+</p>
+<p class="section">
+For example, Apache present in certains recent Linux distributions include the
+<b>
+<font color="#333333">mod_ssl</font>
+</b> module.
+</p>
+<p class="section">
+So if you got such 'Extended Apache', you need to use <b>
+<font color="#333333">mod_jk.so-eapi</font>
+</b>.
+</p>
+<p class="section">
+You should use <b>
+<font color="#333333">mod_jk.so-noeapi</font>
+</b> only for 'Standard Apache' (ie without mod_ssl).
+</p>
+<p class="section">
+It's wise to avoid using EAPI modules on STD API Apache or to use standard API modules on EAPI Apache.
+Allways be sure to have the <b>
+<font color="#333333">mod_jk.so</font>
+</b> witch match your version of Apache
+</p>
+<br/>
+<a name="sub_What's that message about 'garbled DSO ?'">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>What's that message about 'garbled DSO ?'</td>
+</tr>
+</table>
+</a>
+<p class="section">
+It's related to Apache EAPI, the message <b class="code">'mod_jk.so is garbled - perhaps this is not an Apache module DSO ?'</b>
+just told you, that your're trying to install a mod_jk.so DSO module that was compiled on an Apache using EAPI,
+like apache-mod_ssl or apache from Redhat distro 6.2/7.0 but your system use the standard apache with normal API.
+</p>
+<br/>
+<a name="sub_And the message about 'module might crash under EAPI!">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>And the message about 'module might crash under EAPI!</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Also related to EAPI, the message <b class="code">'[warn] Loaded DSO /usr/lib/apache/mod_jk.so uses plain Apache 1.3 API,
+this module might crash under EAPI! (please recompile it with -DEAPI)'</b>, the mod_jk.so was compiled under normal
+Apache with standard API and you try to install the module on an Apache using EAPI.
+</p>
+<br/>
+<a name="sub_APXS is getting an error during the build of mod_jk, like rc=0 or rc=255. I tried all of the steps in the build section, what do I do now ?">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>APXS is getting an error during the build of mod_jk, like rc=0 or rc=255. I tried all of the steps in the build section, what do I do now ?</td>
+</tr>
+</table>
+</a>
+<p class="section">
+APXS is a Perl script that is created when you build the Apache web server from source.
+Chances are that if you are getting these errors and you obtained Apache as a binary distribution,
+that APXS is not configured correctly for your system.
+Your best bet is to get the Apache source from http://httpd.apache.org and build it yourself.
+Use the following for a basic build (read the Apache docs for other options):
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">cd /usr/local/src</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">gzip -dc apache_1.3.19.tar.gz|tar xvf -</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">cd apache_1.3.19</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">./configure --prefix=/usr/local/apache \</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen"> --enable-module=most \</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen"> --enable-shared=max</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">make</b>
+</nobr>
+</code>
+<br/>
+<code>
+<nobr>
+<em class="screen">[user@host] ~ $ </em>
+<b class="screen">make install</b>
+</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+</p>
+<p class="section">
+Note: The above steps assume that you downloaded the Apache source and placed it in your /usr/local/src directory.
+</p>
+<br/>
+<a name="sub_Apache 2.0 complains about incorrect module version">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Apache 2.0 complains about incorrect module version</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Since Apache 2.0 API still change often, the Apache 2.0 teams decide to put in headers of compiled modules the
+Apache 2.0 version used to compile the module. This check is called Magic Module Number bump.
+</p>
+<p class="section">
+At start time Apache 2.0 check that version in modules headers and stop if it detect that a module was compiled
+for another Apache 2.0 version. As such you should allways use modules compiled for the same Apache 2.0 version.
+This check may be removed if the future.
+</p>
+<br/>
+<a name="sub_JNI didn't works with Apache 1.3">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>JNI didn't works with Apache 1.3</td>
+</tr>
+</table>
+</a>
+<p class="section">
+JNI support require a multi-threaded environment which is not the general case for Apache 1.3.
+You should verify if Apache 1.3 has been build with thread support and if not you could add the
+the pthreads library to your <b>
+<font color="#333333">httpd.conf</font>
+</b> file.
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<div class="screen"># Add pthread to Apache in httpd.conf</div>
+<code class="screen">
+<nobr>LoadModule "/usr/lib/libpthreads.so"</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Also keep in mind that JNI is suited for multi-threaded servers and you should consider upgrading
+to Apache 2.0 to support JNI.
+</p>
+<br/>
+<a name="sub_JNI report that JVM couldn't be started under Linux">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>JNI report that JVM couldn't be started under Linux</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Under Linux, you should set some environment variables BEFORE launching your Apache server :
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code class="screen">
+<nobr>export LD_LIBRARY_PATH=$jre/bin:$jre/bin/classic:$LD_LIBRARY_PATH</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+Also some Linux distributions have enabled a GLIBC feature called 'floating stacks' which may not works with kernel
+less than 2.4.10 on SMP machines. You should disable floating stacks by exporting an environment variable :
+</p>
+<p class="screen">
+<div align="center">
+<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="1" width="80%">
+<tr>
+<td align="left" bgcolor="#cccccc">
+<code class="screen">
+<nobr>export LD_ASSUME_KERNEL=2.2.5</nobr>
+</code>
+<br/>
+</td>
+</tr>
+</table>
+</div>
+</p>
+<p class="section">
+You could have to update your service scripts, ie <b>
+<font color="#333333">/etc/rc.d/init.d/httpd</font>
+</b>, to set these env vars
+before your httpd server starts.
+</p>
+<br/>
+<a name="sub_Mixed errors when building via configure">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>Mixed errors when building via configure</td>
+</tr>
+</table>
+</a>
+<p class="section">
+configure assume you have some GNU tools allready installed and configured for your system, and ad minima <b>
+<font color="#333333">libtool</font>
+</b>.
+</p>
+<p class="section">
+Also some systems may have mixed cc and gcc setup which may make you puzzled when trying to link an Apache built with native
+c compiler with a jk/jk2 build with gcc.
+</p>
+<p class="section">
+In fine some native make didn't works as expect so you should use a GNU make <b>
+<font color="#333333">gmake</font>
+</b>.
+</p>
+<br/>
+<a name="sub_JK2 build report error about missing FIONBIO on Solaris 8">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="subsection" bgcolor="#828DA6">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>JK2 build report error about missing FIONBIO on Solaris 8</td>
+</tr>
+</table>
+</a>
+<p class="section">
+In JK2 before v2.0.2, you should add <pre class="section">#define BSD_COMP</pre> in top
+of jk/native2/common/jk_channel_socket.c to have Solaris build succeed.
+</p>
+<br/>
+<br/>
+<a name="IIS">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>IIS</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Informations and FAQ about JK and IIS Web Servers.
+</p>
+<p class="todo">
+ This paragraph has not been written yet, but <b>you</b> can contribute to it.
+ </p>
+<br/>
+<a name="NES/iPlanet">
+<table width="100%" cellpadding="0" cellspacing="0" border="0">
+<tr>
+<td align="left" valign="top" class="section" bgcolor="#525D76">
+<img border="0" vspace="0" hspace="0" align="left" valign="top" src="images/corner.gif"/>NES/iPlanet</td>
+</tr>
+</table>
+</a>
+<p class="section">
+Informations and FAQ about JK and NES/iPlanet Web Servers.
+</p>
+<p class="todo">
+ This paragraph has not been written yet, but <b>you</b> can contribute to it.
+ </p>
+<br/>
+</td>
+</tr>
+</table>
+</body>
+</html>
Propchange: tomcat/site/trunk/docs/connectors-doc-archive/jk2/printer/faq.html
------------------------------------------------------------------------------
svn:executable = *
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org