Hello Neil,
I've tried what you recommend and everything works fine
but I still have a little problem.
Apache and Tomcat work well but separately (not
together).
I have two httpd.conf files, /etc/httpd/conf/httpd.conf
and /APACHE_HOME/conf/httpd.conf. In the procedure
you've sent, you said that we have to include
mod_jk.conf in /etc/httpd/conf/httpd.conf but it doesn't
work out to me (http://localhost/examples doesn't find
the page, but http://localhost:8080/examples does).
Then I tried to do the same
with /APACHE_HOME/conf/httpd.conf and I got the
following message when Apache tried to start:
Syntax error on line 8
of /usr/local/tomcat/conf/mod_jk.conf:
API module structure 'jk_module' in
file /usr/lib/apache/mod_jk.so is garbled - perhaps this
is not an Apache module DSO?
So Apache couldn�t start. When I cut that Include line
from the /APACHE_HOME/conf/httpd.conf both, Apache and
Tomcat start but still work separately.
I suppouse there is some kind of conflict between this
two httpd.conf files, I'd had this problem before, do I
have to rebuild the .so file??, what do you think??
Thanks in advance.
Renato
> I've finally managed to get apache/tomcat running
successfully on a redhat
> 7.1 box (with stock kernel). Since I've seen several
posts asking about this
> so I'll post a quick how-to.
>
> Install Sun's JavaTM 2 Standard Edition, 1.3.1 RC2
> from: http://java.sun.com/j2se/1.3/download-linux.html
>
> Install tomcat (I used Jakarta-Tomcat 3.2.1)
> Setup your classpaths, and environment in /etc/profile
> Here's mine:
> #Java Environment
> JAVA_HOME=/usr/local/java
> export JAVA_HOME
>
> #Tomcat Environment
> TOMCAT_HOME=/usr/local/tomcat
> export TOMCAT_HOME
>
> #Set Classpaths for java servlets
>
CLASSPATH=$TOMCAT_HOME/lib/servlet.jar:$JAVA_HOME/lib/:$T
OMCAT_HOME/lib:$TOMCAT_HOME/classes:.
> export CLASSPATH
>
> Create a directory named classes in your $TOMCAT_HOME
directory
>
> Copy $JAVA_HOME/lib/tools.jar to $TOMCAT_HOME/classes
>
> Change to the $TOMCAT_HOME/classes directory
>
> Expand with the command "jar xvf tools.jar"
>
> Make sure you've added $TOMCAT_HOME/classes to you
classpath as I did above
>
> You should be able to start tomcat as a stand alone
server at this point by
> running the startup.sh script in $TOMCAT_HOME/bin
>
> Test the server by connecting to http://localhost:8080
>
> Shutdown tomcat using the $TOMCAT_HOME/bin/shutdown.sh
script
>
> If all works well all that remains is to integrate
apache and tomcat
> ( if not figure out whats wrong with these
directions ;-0 )
>
> Shutdown Apache
>
> Follow the instructions at:
> http://jakarta.apache.org/tomcat/jakarta-
tomcat/src/doc/mod_jk-howto.html
>
> The only place I deviated from the instructions was:
> Move the original $TOMCAT_HOME/conf/mod_jk.conf to
> $TOMCAT_HOME/conf/mod_jk.conf-orig as a backup
>
> Copy $TOMCAT_HOME/conf/mod_jk.conf -auto to
$TOMCAT_HOME/conf/mod_jk.conf
>
> Change the line --> LoadModule jk_module
libexec/mod_jk.so
> to read --> LoadModule
jk_module /usr/lib/apache/mod_jk.so ( or wherever you
> put it!)
>
> Add the following to your /etc/httpd/conf/httpd.conf:
>
#########################################################
######
> #
#
> # Tomcat support
#
>
#########################################################
######
>
> Include /usr/local/jakarta-tomcat-
3.2.1/conf/mod_jk.conf
>
> I also changed /etc/rc.d/init.d/httpd to start tomcat
as well. Here's my
> script:
> #!/bin/bash
> #
> # Startup script for the Apache Web Server
> # Modified to start apache with tomcat
> # by Neil Jolly <[EMAIL PROTECTED]>
> # chkconfig: - 85 15
> # description: Apache is a World Wide Web server. It
is used to serve \
> # HTML files and CGI.
> # processname: httpd
> # pidfile: /var/run/httpd.pid
> # config: /etc/httpd/conf/access.conf
> # config: /etc/httpd/conf/httpd.conf
> # config: /etc/httpd/conf/srm.conf
>
> # Set path for java and tomcat
>
> #Java Environment
> JAVA_HOME=/usr/local/java
> export JAVA_HOME
>
> #Tomcat Environment
> TOMCAT_HOME=/usr/local/tomcat
> export TOMCAT_HOME
>
CLASSPATH=$TOMCAT_HOME/lib/servlet.jar:$JAVA_HOME/lib/:$T
OMCAT_HOME/lib:$TOMCAT_HOME/classes:.
> export CLASSPATH
>
> # Source function library.
> . /etc/rc.d/init.d/functions
>
> # This will prevent initlog from swallowing up a pass-
phrase prompt.
> INITLOG_ARGS=""
>
> # Source additional OPTIONS if we have them.
> if [ -f /etc/sysconfig/apache ] ; then
> . /etc/sysconfig/apache
> fi
>
> # Path to the httpd binary.
> httpd=/usr/sbin/httpd
> prog=httpd
> RETVAL=0
>
> # Change the major functions into functions.
> moduleargs() {
> moduledir=/usr/lib/apache
> moduleargs=`
> /usr/bin/find ${moduledir} -type f -perm -0100 -
name "*.so" | awk '{\
> gsub(".*/","");\
> gsub("^mod_","");\
> gsub("^lib","");\
> gsub("\.so$","");\
> print "-DHAVE_" toupper($0)}'`
> echo ${moduleargs}
> }
> start() {
> echo -n $"Starting $prog: "
> /usr/local/tomcat/bin/startup.sh&
> daemon $httpd `moduleargs` $OPTIONS
> RETVAL=$?
> echo
> [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
> return $RETVAL
> }
> stop() {
> echo -n $"Stopping $prog: "
> /usr/local/tomcat/bin/shutdown.sh&
> killproc $httpd
> RETVAL=$?
> echo
> [ $RETVAL = 0 ] && rm -
f /var/lock/subsys/httpd /var/run/httpd.pid
> }
>
> # See how we were called.
> case "$1" in
> start)
> start
> ;;
> stop)
> stop
> ;;
> status)
> status $httpd
> ;;
> restart)
> stop
> start
> ;;
> reload)
> echo -n $"Reloading $prog: "
> killproc $httpd -HUP
> RETVAL=$?
> echo
> ;;
> condrestart)
> if [ -f /var/run/httpd.pid ] ; then
> stop
> start
> fi
> ;;
> *)
> echo $"Usage: $prog
{start|stop|restart|reload|condrestart|status}"
> exit 1
> esac
>
> exit $RETVAL
>
>
> Restart your new integrated apache/tomcat server
with /etc/rc.d/init.d/httpd
> start
>
> Test your new server with your browser by accessing
http://localhost/examples
> and running some of the jsp scripts and servlets.
>
> Sorry for the long post, but hope it's helpful (and
hope I remembered
> everything).
>
> Neil
>
>
>
>
--