On Fri, 2004-10-15 at 09:23, Liam O'Hagan wrote:
> May I recommend this excellent guide to integrating Tomcat and Apache on
> RH9 or RHEL3. It took me from a knowledge point of zilch to a working
> installation.
>>http://www.meritonlinesystems.com/docs/apache_tomcat_redhat.html>
I figure I should probably share this since I have it to hand. As I
mentioned before, I have tomcat 4.1.x on Debian woody. Here is an
extract from the documentation I have on its setup relating to the
tomcat/apache setup - it may be of use to someone.
1. Install Java
- Download the latest JDK from java.sun.com and install it.
I used the rpm version and converted it to a debian package
using
alien. Alternatively, a tar.gz version could be used.
- Convert rpm to a deb package.
alien j2sdk1.4.2_03.rpm
- Install the deb package
dpkg -i j2sdk1.4.2_03.deb
- Create a link in /usr/java to the specific version of java (makes it
easier to upgrade)
cd /usr/java
ln -s j2sdk1.4.2_03 j2sdk1.4
2. Install & Configure Tomcat
Tomcat is not packaged in the current stable version of Debian
(3.0r2). If this changes in the future (probably will), then that
should be used if possible. Until that time, it should be installed
from the binary packages downloadable from jakarta.apache.org
- Untar the latest 4.1.x package into /usr/local
- Link the jakarta-tomcat-4.1.30 (or whatever version) directory to
tomcat
ln -s /usr/local/jakarta-tomcat-4.1.30 /usr/local/tomcat
- Replace /usr/local/tomcat/conf/server.xml with the backed up version
of our configuration.
3. Install & Configure Apache and mod_jk connector (connect apache to
tomcat)
- apache can be installed using apt-get:
apt-get install apache
- Ensure that apache is set to startup on bootup
update-rc.d apache defaults
- Install apache-dev required for building the mod_jk connector.
apt-get install apache-dev
- Install gcc used for compiling mod_jk connector.
apt-get install gcc
- Download the latest source for the jakarta-tomcat-connectors (JK1.2)
from http://jakarta.apache.org/site/sourceindex.cgi (current version is
1.2.5)
- Untar the jakarta-tomcat-connectors tarball to a temporary build
directory
mkdir /root/build
cd /root/build
tar -zxf jakarta-tomcat-connectors-jk-1.2.5-src.tar.gz
- Build the connector
cd /root/build/jakarta-tomcat-connectors-jk-1.2.5-src/jk/native
./configure --with-apxs=/usr/bin/apxs
--with-java-home=/usr/java/j2sdk1.4
make
cp apache-1.3/mod_jk.so* /usr/lib/apache/1.3
- Create workers.properties to /etc/apache
Its contents are as follows
#### Start of workers.properties ###
# Define workers
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.1
worker.worker1.port=8009
#### End of workers.properties ###
- Configure /etc/apache/httpd.conf
The default config does not need to be changed much. We must add in
the mod_jk module. The following line should be added right before the
LoadModule line for rewrite_module
LoadModule jk_module /usr/lib/apache/1.3/mod_jk.so
NB: Its important that it comes before the rewrite module.
The last section in the httpd.conf is the Virtual Servers section.
Just immediately before this section we need to add in the configuration
for mod_jk. Add in the following lines
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkRequestLogFormat "%w %V %T"
Next, we need to add in our virtual servers. These are added at the
end of the file. Add in the following lines to define www.example.com
NameVirtualHost www.example.com:80
<VirtualHost www.example.com:80>
<.... snip irrelevant details of our virtual server......>
# ModJK to Tomcat
JkMount /*.jsp worker1
</VirtualHost>
At this stage, the server should be configured. Now time to start it
up with the server with the new config.
- Restart the Server
/etc/init.d/apache restart
.... and the rest of the details in the documentation are application
specific, so I won't include it.
I should really put this up on a publicly accessible web page
somewhere....someday...
Anyway, enjoy!
Cheers,
John
--
John Reilly <jr at inconspicuous.org>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!