Sie sind auf Seite 1von 5

Ha Noi, November 11, 2007

Integrating Tomcat with Xampp

CHAPTER 1

INSTALL TOMCAT, XAMPP AND CONFIGURATION TOMCAT


CONNECTOR

Document from: http://www.serverwatch.com/tutorials/article.php/10825_2203891_2


restart /etc/profile: source /etc/profile
The following steps to config for Tomcat with Xampp

Step 1.
Cho rang ban da co san Tomcat va Xampp duoc cai dat:
Tomcat: //apache-tomcat-5.5.23 (after install it, rename //tomcat)
Xampp: //lampp

Step 2.
Download mod_jk from http://apache.siamwebhosting.com/tomcat/tomcat-
connectors/jk/binaries/linux/jk-1.2.25/i386/
Download file: mod_jk-1.2.25-httpd-2.2.4.so for Xampp ver 1.6.x, then renaming
mod_jk.so
and copy this file to //lampp/libexec

Step 3.
Open file httpd.conf in the path //lampp/etc, insert the bottom this file with the
following line “Include //tomcat/conf/mod_jk.conf”:

Step 4.
create file //tomcat/conf/workers.properties (if not exist), insert the following lines:
workers.tomcat_home=//tomcat

workers.java_home=//jdk1.5.0_11
ps=/
worker.list=worker1, ajp13
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

Step 5. Restart the following services:


- //lampp/lampp stop
-
- Cd //tomcat/bin/
./shutdown.sh
./startup.sh
- //lampp/lampp start

Testing:

In this test, we are directing all URLs that begin with "/jsp-examples" to Tomcat.
In a real world situation, we might only direct JSPs or servlets to the JK worker.
Make sure no other server is running on the default Tomcat ports of 8005, 8009 and
8080.
Make sure no other server is running on the Apache port, which is normally 8080 or
80.
Start Tomcat first: Always start Tomcat first and then start Apache.
If you have to bounce Tomcat, remember to take down Apache first and restart it after
Tomcat restarts.
Start Apache: Point your browser to http://localhost and verify that you get the default
Apache page. Substitute "localhost" for the actual machine name/IP if necessary.
Point your browser to http://localhost:8080 and verify that you get the default Tomcat
page.
Point your browser to http://localhost/jsp-examples/ and verify that you get the index
page for the Tomcat examples.
This will be served by Apache and will indicate that you have completed your
integration of Apache and Tomcat successfully.

CHAPTER 2
CONNECT TO OWN YOUR WEBAPP

Create a file //tomcat/conf/mod_jk.conf, and insert the following this lines:

########## Auto generated on Wed Jul 31 12:53:26 EDT 2002##########

<IfModule !mod_jk.c>
LoadModule jk_module libexec/mod_jk.so
</IfModule>

JkWorkersFile "/opt/tomcat/conf/workers.properties"
JkLogFile "/opt/lampp/logs/mod_jk.log"

JkLogLevel info

<VirtualHost xxx.yyy.com>
ServerName xxx.yyy.com

#################### xxx.yyy.com:/examples ####################


#We can use Worker1 or ajp13 that are the same
# Static files
Alias /examples "/opt/tomcat/webapps/jsp-examples"

<Directory "/opt/tomcat/webapps/jsp-examples">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.jsp
</Directory>

# Deny direct access to WEB-INF and META-INF


#
<Location "/jsp-examples/WEB-INF/*">
AllowOverride None
deny from all
</Location>

#<Location "/jsp-examples/META-INF/*">
#AllowOverride None
#deny from all
#</Location>

JkMount /jsp-examples/*.jsp worker1


JkMount /jsp-examples/* worker1

#################### xxx.yyy.com:/tomcat-docs ####################

# Static files
Alias /tomcat-docs "/opt/tomcat/webapps/tomcat-docs"

<Directory "/opt/tomcat/webapps/tomcat-docs">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.jsp
</Directory>

# Deny direct access to WEB-INF and META-INF


#
<Location "/tomcat-docs/WEB-INF/*">
AllowOverride None
deny from all
</Location>

#<Location "/tomcat-docs/META-INF/*">
#AllowOverride None
#deny from all
#</Location>

JkMount /tomcat-docs/*.jsp worker1


JkMount /tomcat-docs/servlet/* worker1

#################### xxx.yyy.com:/webdav ####################

# Static files
Alias /webdav "/opt/tomcat/webapps/webdav"

<Directory "/opt/tomcat/webapps/webdav">
Options Indexes FollowSymLinks
DirectoryIndex index.jsp index.html index.htm
</Directory>

# Deny direct access to WEB-INF and META-INF


#
<Location "/webdav/WEB-INF/*">
AllowOverride None
deny from all
</Location>

<Location "/webdav/META-INF/*">
AllowOverride None
deny from all
</Location>

JkMount /webdav/*.jsp worker1


JkMount /webdav/servlet/* worker1
</VirtualHost>

Das könnte Ihnen auch gefallen