http://www.slholmes.org/journal/2006/7/15/apache-2-tomcat-5-mod_jk-xp.html
Apache 2 - Tomcat 5 - mod_jk - XP
Posted by

Building a Better Development Environment In Ten Easy Steps
I've decided to finally get my act together and move all of my domains to eApps.com. When using webapps, eApps recommends that we use Apache+Tomcat using a bridge called mod_jk. This will help solve some interesting challenges:
- The web ontology language OWL makes use of XML namespaces to provide its
import
function. - I want to use Protege OWL as the ontology driven development (ODD) foundation for the development of Java web applications.
- I need localhost instances of Apache and Tomcat suitable for offline development
- I do not want to change the namespaces when I deploy. For instance I do not want to change the namespace http://localhost/ontologies... to http://www.slholmes.org/ontologies...
Given this as some starting points, I've managed to come up with the following plan:
- Use my IBM Thinkpad laptop running Windows XP Service Pack 2 for all development.
- Use file Hosts to redirect http://www.slholmes.org/ to 127.0.0.1.
- Bridge Apache 2 to Tomcat 5 using mod_jk.
Prerequisites
Before configuring mod_jk, make sure that Apache and Tomcat are installed and fully functional.
I have successfully installed and initially configured both Apache and Tomcat. Apache was installed several months ago. I believe it is version 2.0.54. The only thing I've really done with it is initially get Rails working with FastCGI. Other than that, my instance of Apache is very much a default configuration. http://localhost/ simply displays the default Apache home page. Tomcat 5 was also installed several months ago. I have deployed Magnolia and CaCMS. I do not have any plans for Magnolia. Although Magnolia is a fine CMS, the user interface for the administrative functions are incredibly slow for significant development work - it's been this way for many years. CaCMS is exceptionally fast. CaCMS has a very simple design which I require because I do not plan to get heavy into Java development.
None of the applications that I've installed are required. Keep in mind, however, you'll want to make sure your local host instances are functioning correctly, so be sure to work with the servers for a while before attempting to connect them together. In my configuration, Apache is set to listen on port 80 and Tomcat is set to listen on port 8080 - both are the defaults.
Before configuring the servers (next section) make sure both Apache and Tomcat services have been stopped.
Configuring the Servers
Many tutorials and mailing list postings exist on the web that describe the mod_jk process. Given the constraints in my description above, my advise is to ignore them all except for the mod_jk documentation at the Tomcat site. None of the tutorials apply to recent versions of Apache, Tomcat or even mod_jk. Also, there are many varieties of mod_jk (jserv, mod_jk2, etc.) but they're all obsolete.
- Download the binary Apache module from the Win32 mod_jk Binaries folder.
- Copy the downloaded file mod_jk-apache-2.0.55.so to Apache's
modules
folder. - Rename the copied file to mod_jk.so.
- Edit the file
server.xml
which is located in Tomcat'sconf
folder - on my system that isC:\Program Files\Apache Software Foundation\Tomcat 5.5\conf
. - Locate the closing tag for the
engine
element:<\engine>
and add the following just before the close tag:<Listener className="org.apache.jk.config.ApacheConfig" modJk="c:/PROGRA~1/APACHE~2/apache2/modules/mod_jk.so" />
Make sure that you alter the path in themodJk
attribute to reflect your installation of Apache. - Restart Tomcat
- Verify that Tomcat created an auto-configuration file. You should have one or more new folders in Tomcat's
conf
folder. On my system, Tomcat created the following folder:c:/PROGRA~1/APACHE~1/TOMCAT~1.5/conf/auto/
and in that folder, Tomcat generated the mod_jk auto-configuration filemod_jk.conf
. - Edit the file
httpd.conf
which is located in Apache'sconf
folder - on my system that isC:\Program Files\Apache Group\Apache2\conf
. - At the bottom of the
httpd.conf
file, add the following:Include c:/PROGRA~1/APACHE~1/TOMCAT~1.5/conf/auto/mod_jk.conf
Make sure that you alter the path to reflect the location of the auto-configuration file (mod_jk.conf
) that Tomcat generated.. - Restart Apache
If everything is configured correctly, you'll be able to open your web browser, browse to http://localhost/
and get your default port 80 web page from Apache. Then, if you try to browse a web application like http://localhost/cacms
you should get your default port 8080 web page from Tomcat.
'JAVA > WAS' 카테고리의 다른 글
PermGen Space (0) | 2007.02.13 |
---|---|
아파치 튜닝 정리 (0) | 2007.01.19 |
Apache 모듈 중 mod_expires -- 이미지 캐시 (0) | 2006.02.22 |
[펌] [weblogic] 웹로직 문제점 방안 (0) | 2006.02.07 |
[펌]웹 해킹을 통한 악성코드 유포사고 주의 (0) | 2006.02.07 |