Integration of Apache and tomcat in Windows

Source: Internet
Author: User

My operating system is Windows XP, and Apache and tomcat are both installed in the following directory:
C: \ Program Files/Apache
Group/apache2 version apache_2.0.47
C: \ Program Files/Apache Group/Tomcat 4.1
Release 4.1
Although my tomcat version is 4.1, I can see that 5.0 is also configured in the book. If you have any questions, please let me know your version and situation.

Integration
1. Download mod_jk1.dll. Note that my version is jk1.3. If you download version 1.4, the configuration may be different.
2. Copy mod_jk1.dll To The apache2/moudules directory.
3. Modify httpd. conf in the directory apache2/conf and add the following Configuration:

Loadmodule jk_module modules/mod_jk1.dll
Jkworkersfile "C: \ Program
Files/Apache Group/apache2/CONF/workers. properties"
Jklogfile "C: \ Program
Files/Apache Group/apache2/logs/mod_jk.log"
Jkloglevel severe

Jkmount/web/* ajp13
Jkmount/*. jsp ajp13
Jkmount/WEB-INF/* ajp13

Note:
Enclose the path with spaces in quotation marks ".

The jkmount configuration instructs Apache to submit satisfied requests to Tomcat Based on URL features.


4. Create a workers. properties text file under the conf directory of Apache and add the following Configuration:

Workers. tomcat_home = "C: \ Program Files \ apache group \ Tomcat
4.1"
# Let the mod_jk module know the tomcat installation path

Workers. java_home = c: \ j2eesdk \ JDK
# Let the mod_jk module know the JDK path

PS = \
Worker. List = ajp13
# The key here is that the name must be consistent with that of httpd. conf. If httpd. conf is changed here, it should also be changed.

Worker. ajp13.port = 8009
# Working port: JK listening port of Tomcat. You can view port = "8009" in server. xml"
Protocolhandlerclassname = "org. Apache. JK. server. jkcoyotehandler" <Connector

Worker. ajp13.host = localhost
# Tomcat machine. If it is installed on a machine different from Apache, you need to set the IP address

Worker. ajp13.type = ajp13
# Type. It seems that it cannot be changed. A problem may occur.
Worker. ajp13.lbfactor = 1
# This is not clear

5. Check the port configuration after the above configuration. Generally, Tomcat listens to two ports 8080 and 8009 at startup, of which 8080 is the Web Service port. After the test is successful, you can disable the port; 8009 is a port dedicated to integration with other Web servers. XML can be modified, and then restart tomcat. When installing Apache, you can select port 80 or 8080. Note that the port does not conflict with Tomcat. You can select port 80.

6. You can test the settings as follows:
Access Tomcat directly through port 8080, write down one of the URLs, and then modify the Apache configuration to map and test. For example, I deploy a web
Service, the URL is as follows:
Http: // localhost: 8080/web/index.html
Http: // localhost: 8080/web/services/hellosession
Http: // localhost: 8080/web/services/hellosession? WSDL
To switch all URLs starting with/Web to Tomcat, I added the configuration in httpd. conf.

Jkmount/web/* ajp13

Restart Apache and use the following URL for testing.
Http: // localhost/web/index.html
Http: // localhost: 8080/web/services/hellosession? WSDL

Check Apache logs/mod_jk.log to check whether all requests have been sent to Tomcat.

7. Conclusion
mod_jk.dll is an interactive bridge between APACHE and tomcat. It is loaded and called by Apache as a module of Apache.
mod_jk and tomcat are Client/Server modes. Therefore, you must know the port on which Tomcat JK listens when configuring mod_jk. Once integrated, you can close the Tomcat web port to save resources and reduce security risks.
to ensure good cooperation between APACHE and tomcat, the most important thing is that your application is well designed, in this way, you can configure a small number of jkmount entries to handle the Tomcat operations.
8. Expand
Apache can configure loadbalance so that multiple Tomcat servers can share the processing business. In this way, Apache processes some static page calls, while complicated logic processing, database processing involves multiple Tomcat for sharing. It can greatly improve the processing capability of your website. The basic configuration of loadbalance is also very simple. Out of my responsibility, I will post it to my blog after practice. Please stay tuned.
In addition, Tomcat can be well integrated with JBoss, so that no problem occurs when EJB is required.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.