[TriLUG] Apache, Java, Servlets, oh my!
David A. Cafaro
dac at cafaro.net
Fri Mar 1 09:53:42 EST 2002
Presently my work project is running Apache 1.3.22, Tomcat 4.0.1, Sun J2SE
1.4beta2, and MySQL 3.23.49. It was pretty simple to setup.
First get Java up and running on your computer. I used Sun's J2SE, but a
lot of people like the one from IBM, check their licenses (I'm using it for
a medical/educational based web site). Then get tomcat. I would go for
the 4.0 series, it is much easier to setup (though the documentation is
pretty alpha version). I just downloaded the tar.gz file and dumped it
into the directory of my choice. Then I just added the startup scripts
from the bin directory into my init.d so that I could have it startup at
boot. There are some configs to do in the scripts to make sure it knows
where your directory is and such. Also check the tomcat config
workers.properties and add your locations like this:
# Setup for RedHat Linux 7.2
# Created Feb 6, 2002
workers.tomcat_home=/raid/tomcat
workers.java_home=/usr/Java/j2sdk1.4.0
ps=/
worker.list=ajp2, ajp13
# Definition for Ajp13 worker
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
Once that is up you should test to make sure tomcat is up and running by
surfing to the localhost:8888 port where it sits by default.
I used the Apache RPM's that came with my distro (RH7.2), downloaded the
mod_jk.so Apache Mod file from the tomcat web site (ok this file is hard to
find, I'll look for the location and pass it on if you would like). The
mod_jk.so file go into the /etc/httpd/modules/ directory. In the
httpd.conf file add something like the following:
# Add the mod_jk module
LoadModule jk_module modules/mod_jk.so
AddModule mod_jk.c
# Configure mod_jk
JkWorkersFile /raid/tomcat/conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
You will also need to make sure Apache knows what type of files to send to
Apache with something like this:
<VirtualHost 10.101.120.10:80>
ServerAdmin admin at myserver.edu
DocumentRoot /raid/myserv/
ServerName myserv.myserver.edu
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
ErrorLog logs/myserv.myserver.edu-error_log
CustomLog logs/myserv.myserver.edu-access_log common
</VirtualHost>
Now to finish getting them to talk you need to modify tomcat's server.xml
file. For example I added this too in the main engine section to add one
of my virtual servers.
<Host name="myserv.myserver.edu" debug="0" appBase="/raid/myserv/"
unpackWARs="true">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="myserv_access_log." suffix=".txt"
pattern="common"/>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="myserv_log." suffix=".txt"
timestamp="true"/>
<Context path="" docBase="/raid/myserv/" debug="0"/>
</Host>
If you are just adding this to a single server (single web site) then you
should only need to add your directory tree to the default <host> located
in the same main engine section.
Before doing any of this I would recommend reading all the
documentation. The important stuff is really the tomcat 4.0 stuff, it's
good just to have a good idea of what the sections in the
workers.properties and server.xml files mean. Well good luck, and I would
be happy to go into more detail and help with this setup. I am very happy
with how well it is working for me.
David
At 03:43 AM 3/1/2002, Tanner Lovelace wrote:
><file://C:\Documents and Settings\dac38\Application
>Data\Qualcomm\Eudora\attach\[TriLUG] Apache, Java, Servlets.ems
><0880.0002>>155283.jpg<file://C:\Documents and Settings\dac38\Application
>Data\Qualcomm\Eudora\attach\[TriLUG] Apache, Java, Servlets.ems
><0880.0002>> [TriLUG] Apache, Java, Servlets.ems
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 155283.jpg
Type: image/jpeg
Size: 2322 bytes
Desc: not available
URL: <http://www.trilug.org/pipermail/trilug/attachments/20020301/28c2a158/attachment.jpg>
More information about the TriLUG
mailing list