Integration of Apache2.2 and Tomcat6 in Ubuntu12.04
Source: Internet
Author: User
Anyone who has experience in server setup in the integration of Apache2.2 and Tomcat 6 in Ubuntu12.04 knows the following advantages if Tomcat and Apache are integrated for J2EE Development: 1, use Apache for load balancing and fault tolerance; 2. Apache focuses on static web page parsing, and tomcat focuses on doing so... anyone who has experience in server setup in the integration of Apache2.2 and Tomcat 6 in Ubuntu 12.04 knows the following advantages if Tomcat and Apache are integrated for J2EE development:
1. use Apache for load balancing and fault tolerance. 2. Apache focuses on static web page parsing and tomcat focuses on dynamic web page parsing, which can improve server efficiency. 3, applications can be upgraded seamlessly.
I recently used Ubuntu12.04 as a server (in principle, I should not use the latest version but a stable version). I have read many books on apache and tomcat integration, finally, I found that the content in the book is a little different for ubuntu12.04. Below summarizes the experience for your reference: install apache and tomcat and install mod_jk (sudo apt-get install libapache2-mod-jk) this does not say, this is the premise.
1. the AJP connector Tomcat6 provides the AJP connector implementation as a java class for the AJP protocol, which is included in the Tomcat release version. First, you should Define the Connector in $ CATALINA_HOME/server. xml: www.2cto.com <-- Define an AJP1.3 Connector on port 8009 --> Generally, you can remove the comments and add them without them.
2. compile workers. properties file workers. the properties file is used to define some variables that are connected to tomcat, you do not need to create it yourself, you have created a file in the/etc/libapache2-mod-jk/directory when installing the libapache2-mod-jk package, you can modify it directly: $ sudo nano/etc/libapache2-mod-jk/workers. properties
Modify the corresponding row as follows: worker. list = myworker worker. myworker. port = 8009worker. myworker. host = localhost // If you are on another server, change it to the corresponding host ipworker. myworker. type = ajp13worker. myworker. lbfactory = 1worker. loadbalancer. type = lbworker. loadbalancer. balance_workers = myworker
3. configure/etc/apache2/apache2.conf (we recommend/etc/apache2/conf here. d/create the mod_jk file in the directory, and write the same content in this step) www.2cto.com # tell JK where to find workers. propertiesJkWorkersFile/etc/libapache2-mod-jk/workers. properties # if the prompt "allow once" appears after apache is restarted, comment out this line # define the JK log location JkLogFile/var/log/apache2/mod_jk.log # set the JK log level (debug/error/info) jkLogLevel info sets the Log format JkLogStampFormat "[% a % B % d % H: % M: % S % Y] "# JK option JkOption + ForwardKeySize + ForwardURICompat-ForwardDirectories # set request format JkRequestLogFormat" % w % V % T"
4. configure the VM $ sudo nano/etc/apache2/sites-available/default and add the following code at the end: www.2cto.com .....JkMount/*. jsp myworker # send all jsp page requests to myworker for processing JkUnMount/*. php myworker # none of php page requests are sent to myworker for processingFive, should note: Many books are said to add mod_jk.so to the module directory of apache, but if you install the libapache2-mod-jk through sudo apt-get install successfully, it is not needed, it also automatically writes the LoadModule to you ~ Author JunSong
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