Contributed documentation for jk2 PS: Note the info that Jetty will also implements ajp13 :)
>-----Original Message----- >From: Simon Stewart [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, June 25, 2002 3:24 AM >To: GOMEZ Henri >Subject: Re: Configuring mod_jk2 > > >Attached is a copy of the notes that I've made so far. They're in a >similar style to the previous HOWTO, but should be up to date :) I >assume that the final release will be available from the URL that I >give. > >I've managed to get the latest version of mod_jk2 from cvs installed >and working. Looking at logs, I notice that I need to set >"${serverRoot}" to point towards the apache root directory. Is there >any way to do this within the jk2.properties file? > >In any case, please could you have a look at the docs as they stand, >and shout out if there's anything wrong? Once you've done that, I'll >pass it on to everyone to pick apart. :)) > >Finally, I assume that you knew that Jetty was also planning on >providing an AJP13 connector? Once I've got the apache 2 and JBoss 3 >(via Tomcat 4.0.3) notes done properly, I plan to cover Jetty too. Is >that okay? Are there any surprises lurking there? > >Apologies if some of the English in the HOWTO (or this email, for that >matter) is a little sloppy. It's a little in the morning for me to be >properly making sense. :)) > >Regards, > >Simon > >On Mon, Jun 24, 2002 at 03:34:41PM +0200, GOMEZ Henri wrote: >> FOR the latest jk2 you should have >> a workers2.properties file: >> >> Add : >> >> There is an example file in jtc/jk2 >> >> [ajp13:localhost:8019] >> channel=3Dchannel.socket:localhost:8019 > >Cheers, > >Simon > >-- >As the saying goes, if you give a man a fish, he eats for a day. If you >teach him to grep for fish, he'll leave you alone all weekend. If you >encourage him to beg for fish, pretty soon c.l.p.misc will smell like a >three-week-dead trout. -- Tom Phoenix, c.l.p.misc. >
Apache 2.0.39 and Tomcat 4.0.4 1. Download the source for Apache 2 from http://httpd.apache.org. Configure and install it at ${apache2.home} It is essential that DSO (Dynamic Shared Object) support is compiled in. This is done using the "--enable-so" configure parameter, 2. Get hold of the latest version of the jakarta-tomcat-connectors (jtc) source from "http://jakarta.apache.org/builds/jakarta-tomcat-4.0/src" 3. Unpack the source code into ${jtc.home} and "cd" to this directory. 4. In order to build mod_jk2 successfully, you must now edit a handful of files. To do this: cd util cp build.properties.sample build.properties You do not need to edit the new build.properties file. cd ${jtc.home}/jk cp build.properties.sample build.properties Edit the "build.properties" file. At the top of the file, define a new "catalina.home" that points to where-ever Tomcat is currently installed: catalina.home=/usr/local/tomcat-4.0.4 Now make edit the tomcat40.home line: tomcat40.home=${catalina.home} You will also need to point the apache2.home property somewhere sensible. The reason for stating a ${cataline.home} is that otherwise the build process will try to build mod_jk2 for both Tomcat 4 and 4.1, one of which probably isn't installed on your system. Don't edit the remaining entries. They provide defaults that don't get used when compiling, and so are harmless. cd ${jtc.home}/coyote cp build.properties.sample build.properties Edit this file, and make sure that catalina.home points to the root of your Tomcat installation. 5. You are now ready to build the java side of mod_jk. cd ${jtc.home} ant This will ultimately build a jtc.jar file. You should see a few warnings about classes over-riding deprecated APIs, but no errors during the build process. 6. To install the java side of mod_jk2: cd ${jtc.home}/jk/build/lib cp tomcat-coyote.jar tomcat-jk2.jar commons-logging.jar \ tomcat-util.jar commons-logging.jar ${catalina.home} cp tomcat-jni.jar ${catalina.home}/bin where ${catalina.home} is the base of the tomcat installation. This process will overwrite some of the original jar files, so you might want to back them up before deleting them. 7. cd ${catalina.home} vi conf/server.xml Comment out any existing connectors, especially the current ajp13 connector. In the same area of the config file, you should now add the following: <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="20000" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" /> This should configure tomcat to use the newly installed coyote handler to listen on port 8009 (the original ajp13 port) for incoming connections. In addition, it will use mod_jk as the connector. 8. Now that the Java side od mod_jk2 has been installed, the apache module has to be compiled. This provides the glue to connect the java connector to the web server itself. cd ${jtc.home}/jk ant native Although there will be a few warnings from the compiler. These errors are expected, and shouldn't cause concern. Fatal errors, however, indicate that something is amiss. It might be a good idea to check your build environment if this happens; on Solaris, for example, setting PATH to have /usr/ucb, /usr/bin and /usr/ccs/bin at the head might help. It might also be an idea to consider using the GNU toolchain. This process has been tested using gcc 2.95.4 and libtool 1.4.2a successfully (on Linux, at least) 9. Copy the newly created mod_jk2.so to the apache 2 modules directory. cp build/jk2/apache2/mod_jk2.so ${apache2.home}/modules and also copy over the JNI part of mod_jk2 to somewhere sensible cp ${jtc.home}jk/build/jk2/jni/libjkjni.so ${catalina.home}/lib 10. You are almost ready to test the module, but first apache must be told to load it. cd ${apache2.home} vi ./conf/httpd.conf Search for any other "LoadModule" directives, and just below them add: LoadModule jk2_module modules/mod_jk2.so Before making any other changes, save httpd.conf and then run the command: ${apache2.home}/bin/apachectl configtest This should pass without any errors. On some systems, you might get a warning about apache not being able to determine the server name. If this should prove to be the case, it's easily fixed by uncommenting the "ServerName" directive and entering a valid host name and port. ServerName 127.0.0.1:80 will normally suffice. 11. Because loading modules is optional in apache, any config options should be contained in the httpd.conf in a section similar to: <IfModule mod_jk2.c> ... mod_jk2 options here. ... </IfModule> Having said this, currently none of my mod_jk2 configuration is embedded within my httpd.conf. This means that if I were to use mod_jk2 to connect to the embedded Tomcat 4 in a JBoss 3 release, or even a copy of Jetty, I do not need to reformat the configs. 12. This begs the question: how is mod_jk2 configured. It's done using 2 seperate files, one for tomcat and one for mod_jk2. The format of these files is given elsewhere, but some examples never go amiss. The first config file is named "jk2.properties" and is found at ${catalina.home}/conf/jk2.properties. This is a relatively simple file which allows you to override and set various values on the tomcat side of mod_jk2: ---- workers2.properties # list of needed handlers. handler.list=apr,channelSocket,channelUnix,request # Set the default port for the channelSocket channelSocket.port=8009 # State where the UNIX domain socket is located channelUnix.file=/home/sms/tomcat/work/jk2.socket # Dynamic library serverRoot=/usr/local/apache2 apr.NativeSo=/home/sms/tomcat/lib/libjkjni.so ---- end of workers2.properties Obviously, references to "/home/foo/tomcat" should be replaced with whatever your ${catalina.home} points to. The most interesting part of this file is the "Dynamic library" section. Without this, setting up the UNIX domain socket will fail, although it will still be possible to use normal TCP/IP sockets. The reason for setting up a UNIX domain socket is simply one of speed: a full blown TCP/IP socket is comparitively slow, and on a heavily loaded server this might prove troublesome. The second config file, used by mod_jk2 is called "workers2.properties" and is found in ${apache2.home}/conf/ # Not sure why this needs to be set, but it does [shm] file=/usr/local/apache2/logs/shm.file size=1048576 # Example socket channel, explicitly set port and host. [channel.socket:localhost:8009] port=8009 host=127.0.0.1 # Example UNIX domain socket [channel.un:/home/sms/tomcat/work/jk2.socket] tomcatId=localhost:8009 debug=0 # define the worker [ajp13:localhost:8009] channel=channel.un:/home/sms/tomcat/work/jk2.socket # To use the TCP/IP socket instead, just comment out the above # line, and uncomment the one bwloe #channel=channel.socket:localhost:8009 # Announce a "status" worker [status:status] # Uri mapping [uri:/examples/*] #worker=ajp13:localhost:8009 worker=ajp13:/home/sms/tomcat/work/jk2.socket [uri:/status/*] worker=status:status 13. Once the config files have been written and installed in the correct places, start Tomcat, wait long enough for it to complete startup, and then start apache2. Test the tomcat connection by viewing a URL on port 8080, and then (assuming that it's mapped in the workers2.properties file) try the equivalent URL by connecting to apache instead. Congratulations! You've successfully got Tomcat and mod_jk2 talking to one another!
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>