Link to home
Start Free TrialLog in
Avatar of ellandrd
ellandrdFlag for Ireland

asked on

running apache 2.2.x and tomcat 6.0.2

on my laptop im running apache 2.2.x with 16 virtual hosts.  im also running PHP 5.2.x with MySQL 5.x.  I have just installed tomcat apache 6.0.2 so i can now support JSP and servlets.  Can somebody help me configure tomcat and apache so they speak and apache send tomcat apache all jsp requests etc...
SOLUTION
Avatar of ramazanyich
ramazanyich
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ellandrd

ASKER

yes this is a great site - i havent fully read the whole lot, but hopefully i will later today.  i have just browsed over it quickly and it looks like what im after.

however, my understanding of how tomcat apache and apache http server work together is a little poor.

can you answer this question for me please.

when i try running a PHP page under:

w:\apache\htdocs\index.php,

apache will handle it on its own right?  but when i try running a JSP page under:

w:\apache\htdocs\index.jsp,

will apache send the request to tomcat server and retreive the results again or will i have to call the JSP from the tomcat server like:

w:\apache\tomcat\webapps\root\index.jsp

see this is where i get all confused to how it actually works??
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
much clearer now!

thank you.  i will be configuring tomcat and apache tonight as im in work at the moment...
ok im stuck.

im as far as "Simple configuration example".  i dont know what to replace for mine to work??

also i dont have a workers.properties file either??

tomcat apache is installed under:

w:\apache\tomcat\conf
w:\apache\tomcat\bin
....
w:\apache\tomcat\webapps


and apache web server is installed under:

w:\apache\conf
w:\apache\htdocs
....
w:\apache\modules

apache wont restart for me now either??

im running apache and tomcat apache on windows xp pro sp2...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
should the workers.properties file be in:

w:/apache/tomcat/conf or
w:/apache/conf  

as im getting confused...

what about servlets?

>>tomcat_host_name by DNS name of your server (or IP address)

i have tomcat running on localhost port 8080 or 127.0.0.1:8080...  will this be what i have to replace with tomcat_host_name?
i still cant get apache httpd server to start.

tomcat apache starts fine.

i had to comment out this lines to get apache httpd server:

LoadModule jk_module w:/apache/modules/mod_jk.so
#AddModule mod_jk.c
#JkWorkersFile w:/apache/tomcat/conf/workers.properties
#JkLogFile w:/apache/logs/mod_jk.log
#JkLogLevel info
#JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
#JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
#JkRequestLogFormat "%w %V %T"
#JkMount /*.jsp worker1

i have created the workers.properties file and stored it in w:/apache/tomcat/conf/workers.properties.

i have noticed there is other *.properties files inn that directory too...

in my logs folder i have this: (error.log)

[Wed Nov 22 08:40:05 2006] [notice] Apache/2.2.3 (Win32) PHP/5.2.1-dev mod_jk/1.2.19 configured -- resuming normal operations
[Wed Nov 22 08:40:05 2006] [notice] Server built: Jul 27 2006 16:49:49
[Wed Nov 22 08:40:05 2006] [notice] Parent: Created child process 2876
PHP Warning:  PHP Startup: java: Unable to initialize module\nModule compiled with module API=20060613, debug=0, thread-safety=1\nPHP    compiled with module API=20050922, debug=0, thread-safety=1\nThese options need to match\n in Unknown on line 0
[Wed Nov 22 08:40:06 2006] [notice] Child 2876: Child process is running
[Wed Nov 22 08:40:06 2006] [notice] Child 2876: Acquired the start mutex.
[Wed Nov 22 08:40:06 2006] [notice] Child 2876: Starting 250 worker threads.
[Wed Nov 22 08:40:07 2006] [notice] Child 2876: Starting thread to listen on port 80.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok ive commented this line out and now apache httpd server wont start...

#LoadModule php5_module "W:/PHP/php5apache2_2.dll"
you should comment out all php related config lines, because it is not only LoadModule.
could you send your httpd.conf file ?
ok 2 secs
did you get my httpd.conf file?
yes I did, but don't see anything wrong in it.
Maybe something in included conf file  conf/extra/httpd-vhosts.conf ?
Do you syill have the same error in log file ?
yes
could you send contents of   conf/extra/httpd-vhosts.conf file too ?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
see this worker.properties file - where do i put this? in:

w:/apache/conf

or

w:/apache/tomcat/conf

??

also see the content of the worker file:

worker.list= worker1
worker.worker1.host=tortuga  <<------------ do i change this to 127.0.0.1:8080 or 127.0.0.1
worker.worker1.port=8009
worker.worker1.type=ajp13

>>port number changed from 8007 to 8009

why?  will have i have to change mine??
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok apache httpd server is running on localhost port 80 and tomcat apache is running on localhost port 8080 so which port? apache httpd or tomcat server?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok but do i put localhost as host or localhost:8080 ?
i can get tomcat running on localhost:8080 fine and i can get apache running on localhost fine, but still cant get tomcat and apache to work together...

here is my httpd.conf file part:

LoadModule    jk_module  modules/mod_jk.so
JkWorkersFile w:/apache/conf/workers.properties
JkLogFile     w:/apache/logs/mod_jk.log
JkLogLevel    info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat     "%w %V %T"
JkMount  /*.jsp worker1


in my workers.properties files in w:/apache/conf/workers.properties i have this:

worker.list=worker1
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.type=ajp13


the ajp section in my server.xml file looks like this:

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
and when i start tomcat i get this:

24-Nov-2006 08:48:09 org.apache.catalina.core.AprLifecycleListener lifecycleEve
t
INFO: The Apache Tomcat Native library which allows optimal performance in prod
ction environments was not found on the java.library.path: C:\Java\jdk1.6.0\bin
.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:
WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:
WINDOWS\system32;C:\WINDOWS;%CATALINA_HOME%\bin\startup;C:\Java\jdk1.6.0\bin;C:
Java\ant\bin;C:\PHP\;W:\Perl\bin\perl.exe\;W:\OpenSSL\bin\;
24-Nov-2006 08:48:09 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
24-Nov-2006 08:48:09 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 621 ms
24-Nov-2006 08:48:09 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
24-Nov-2006 08:48:09 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.2
24-Nov-2006 08:48:09 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
24-Nov-2006 08:48:10 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
24-Nov-2006 08:48:10 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
24-Nov-2006 08:48:10 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=10/20  config=null
24-Nov-2006 08:48:10 org.apache.catalina.startup.Catalina start
INFO: Server startup in 921 ms

and when i do this:  http://localhost/examples/servlets/

i get 404 page not found...
i got JSP pages working... sorry it was my own stupidy!

how about serlvets?


and another thing i dont understand and im hoping you'll clear up is do i have to put all my .jsp pages under exmaples directory on tomcat apache server or can i put them under:

w:/apache/htdocs/jsp/

if so how come i cant get them to work?  the message i get is this:

HTTP Status 404 - /jsp/index.jsp

type Status report

message /jsp/index.jsp

description The requested resource (/jsp/index.jsp) is not available.
Apache Tomcat/6.0.2


also how can i get servlets working?
for servlets you should add additional JkMount config line based on URL path.
for example to make path /examples/servets to redirect to Tomcat add in httpd.conf file:

JkMount /examples/servlets/*
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok last question before i accept - can you clear up thist please:

11/24/2006 09:14AM GMT

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you for all your help and patience with me.

your explanations where great!

ellandrd