PDA

View Full Version : Apache2 & Tomcat 5 passing jsp's


windago
06-20-2006, 01:51 PM
Hey all,

Hope I picked the correct place to post this delemma.

I am running apache 2.0.58 with Tomcat 5.5.16. I have jdk1.5.0_06 installed and working. I then used jakarta-tomcat-connectors-1.2.14.1-src to link everything up.

Once all installed and configured, I was able to bring up the tomcat homepage and example pages without any problems. Where the trouble comes in is when I try to pass jsp's to Tomcat through Apache 2.

I have 2 renditions of a site. Once is located in /var/www/html running off port 80. This is the production version of the site. In /home/ajbtoc/src/reStuff/Website running off port 8080 is the test site. Since this is a company site I could not change 8080, not a big deal. I changed the default port for Tomcat to 8081 and it works fine. But basically I need all jsp files in those 2 directories to be passed from Apache2 to Tomcat.

I have done a huge ammount of digging and found a number of different supoosed ways to do it, but none seem to be working for me.

httpd.conf

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /*.jsp worker1

<VirtualHost *:8080>
ServerAdmin me@mydomain.com
DocumentRoot /home/ajbtoc/src/reStuff/WebSite/
ServerSignature email
DirectoryIndex index.php index.html index.htm index.shtml index.jsp
ServerSignature email
LogLevel debug
HostNameLookups off
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /*.jsp worker1
</VirtualHost>


I have also tried using JKMount on the full dir paths there..


workers.tomcat_home=/usr/local/tomcat
workers.java_home=/opt/jdk/jdk
worker.worker1.type=ajp13
worker.worker1.host=my.hostname.com
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300


I know it is probably something simple with the config. I have never used tomcat before and have only been dealing with apache2 for a short while. For example I do not know if any updates would need to be made to the server.xml. If anyone could help that would be awsome!

Thanks,
Matt

Mongus
07-14-2006, 09:07 AM
You need to tell Tomcat where your document root is in server.xml. Something like this should work for you:

<Host name="localhost">
<context path="" docBase="/var/www/localhost/htdocs/" />
</Host>

Apache doesn't actually send the jsp files to Tomcat. When it sees a request that matches the patterns you've specified it just sends the path to Tomcat and sends Tomcat's response back to the client.