A New Approach to Apache and Tomcat Integration

Source: Internet
Author: User
A New Method for integrating Apache and Tomcat-Linux Enterprise Application-Linux server application information. For details, refer to the following section. I will announce a new method for integrating Apache and Tomcat. It was found some days ago when I read the documents on the Official apache and tomcat websites.

Purpose:
Use apache as the front-end of two tomcat servers and forward the client request and server reponse.
Apache address: 10.194.0.131
Tomcat server address: 10.11.1.29, 10.11.1.2

The configuration steps are as follows:
1. Download the source code of the new versions of Apache 2.0.54 and Tomcat Connector 1.2.14.1, compile and install Apache and Connector:
1. Run BuildConf, Configure -- prefix =/usr/local/Apache2.0.54, make, and make install in the Apache source code directory to install Apache in the/usr/local/Apache2.0.54 directory.
2. run BuildConf and Configure -- with-apxs =/usr/local/Apache2.0.54/bin/apxs, make, and make install in jk/native/of the Connector source code directory, install mod_jk.so in the/usr/local/Apache2.0.54/modules directory.

Ii. Configure apache:
1. Configure the workers attribute file: Create the workers. properties file in the conf directory of apache. The content is as follows:

Ps =/
Worker. list = worker1, jvm1
Worker. worker1.port = 8009
Worker. worker1.host = 10.11.1.29
Worker. worker1.type = ajp13
Worker. worker1.socket _ keepalive = true
Worker. jvm1.port = 8009
Worker. jvm1.host = 10.11.1.2
Worker. jvm1.type = ajp13
Worker. jvm1.socket _ keepalive = true

2. Configure httpd. conf:
Add the following content to the LoadModule configuration section:

LoadModule jk_module modules/mod_jk.so
# Where to find workers. properties
JkWorkersFile/usr/local/apache2.0.54/conf/workers. properties
# Where to put jk logs
JkLogFile/usr/local/apache2.0.54/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[% a % B % d % H: % M: % S % Y]"
# JkOptions indicate to send ssl key size,
JkOptions + ForwardKeySize + ForwardURICompat-ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "% w % V % T"

Configure the following content in VirtualHost:

NameVirtualHost *: 80

ServerAdmin webmaster @ demo
ServerName 10.11.1.29
DirectoryIndex index. jsp index.html

JkMount/* worker1

ServerAdmin webmaster @ print
ServerName 10.11.1.2

JkMount/* jvm1

3. Configure tomcat:
1. Modify the server. xml file 10.11.1.29:
Find... Add the jvmRoute attribute:

2. Modify the server. xml file of 10.11.1.2:
Find... Add the jvmRoute attribute:

5. Extended functions:
You can configure multiple tomcat servers for the same web application and use the server Load balancer feature of apache to achieve load balancing among multiple servers for the same web application, improve web access efficiency. The example in this article does not implement this feature. Try it by yourself according to the document.
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.