Use mod-jk in linux to integrate apache and tomcat
Source: Internet
Author: User
In linux, use mod-jk to integrate apache and tomcat-Linux Enterprise Application-Linux server application information. The following is a detailed description. See clearly, this is mod-jk, not outdated mod-jk2, the following take ubuntu6.10 version as an example to illustrate the simple installation process.
1. install java or jre and configure the path.
2. install apache.
Sudo apt-get install apache2
3. install tomcat.
To Install Multiple tomcat servers, I pulled xxx.tar.gz from the official website of tomcat and decompressed it, for example, to/usr/local/tomcat.
5. Configure the apache main directory to the tomcat main directory.
Unlike an httpd. conf file in windows, there are a lot of apache configuration files in linux. in/etc/apache2, apache2.conf contains many other files.
Modify the apache directory to direct it to the webapps directory of tomcat. Modify the/etc/apache2/sites-available/default file.
Direct the Directory under DocumentRoot and the Directory below to/usr/local/tomcat/webapps.
6. Use the jsp file as the main file
Edit/etc/apache2/apache2.conf and add an index. jsp
7. Set the link
Create a workers. properties File
Touch/etc/apache2/workers. properties
Edit it and add the following content
Worker. default. port = 8009
Worker. default. host = localhost
Worker. default. type = ajp13
Worker. default. lbfactor = 1
Among them, worker. tomcat_home is the tomcat installation directory, and workers. java_home is the java directory. If the JAVA_HOME or JRE_HOME line has been set, this line can be omitted.
8. Set mod-jk
Edit/etc/apache2/mod-available/jk. load
Add the following content
# JkRequestLogFormat set the request format
JkRequestLogFormat "% w % V % T"
# Send servlet for context/jsp-examples to worker named worker1
JkMount/jsp-examples worker1
# Send JSPs for context/jsp-examples/* to worker named worker1
JkMount/jsp-examples/* worker1
JkUnMount/*. jpg worker1
In total, JkMount and JkUnMount can be configured. The file or file type in the directory of JkMount must be processed by tomcat, while JkUnMount is filtered out, the configuration depends on your web application.
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.