Two days later, I made another Apache and Tomcat integration for my friend. But this time, unlike the past, Apache and Tomcat are not on the same server, and the operating system is different. His server environment is as follows: 1. Apache is installed in Windows; 2. Tomcat is installed in Linux; the following two methods of integration of Apache and Tomcat are listed below.
In the past two days, I have made Apache and To for a friend.McAt integration, but this is different from the past: Apache and TomCatNot on the same server, and the operating system is different. The server environment is as follows:
1. install Apache on Windows;
2. Tomcat is installed in Linux;
The following describes how to integrate Apache and Tomcat on different servers and platforms.
There are only several ways to integrate Apache with Tomcat:
1. mod_jk method (commonly used );
2. reverse proxy;
3. Other Methods
1. Integration of a single server:
1. Install jdk
2. install apache
3. install tomcat
4. Install JK
The first three points are omitted (I think it's hard for everyone, huh, huh)
Download JK 4.1
The address can be downloaded here:
Http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.26/
Or
Http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/
* Note that the JK version must be the same as the Apache version. If your version is different from mine, you can download it from the official website. There are multiple versions available for various operating systems.
4.2 install JK
Window:
Push mod_jk-1.2.26-Httpd-2.2.4.so copy to $ Apache_Home \ moDuLes.
Linux:
Copy mod_jk-1.2.26-httpd-2.2.4.so to/etc/httpd/modules.
5. Server Configuration
5.1 create the mod_jk.conf configuration file
Run:Vi/etc/httpd/conf/mod_jk.conf
Then add the following content:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile "/etc/httpd/conf/workers. properties"
JkShmFile/var/log/httpd/mod_jk.shm
JkLogFile/var/log/httpd/mod_jk.log
JkLogLevel info
JkMount/*/servlet/* ajp13
JkMount/*. jsp ajp13
JkMount/*. do ajp13
ADdType application/x-jsp. jsp
5.2 create the workers. properties configuration file
Run:Vi/etc/httpd/conf. d/workers. properties
Then add the following content:
[Shm]
File=/Etc/httpd/logs/shm. file
Size = 1048576
[Channel. socket: localhost: 8009]
TomcatId = localhost: 8009
[Uri:/jsp-ExAmples/*]
Workers. tomcat_home =/usr/local/tomcat7
Workers. java_home =/usr/local/jdk1.6.0 _ 27
Ps = \
Worker. list = ajp13
Worker. ajp13.port = 8009
Worker. ajp13.host = localhost
Worker. ajp13.type = ajp13
Worker. ajp13.lbfactor = 1
Now, some apache configurations are complete.
* Note: you may encounter the following problems:
Httpd: Syntax error on line 216 of/etc/httpd/conf/httpd. conf: Syntax error on line 4 of/etc/httpd/conf/mod_jk.conf: Cannot load/etc/httpd/modules/mod_jk.so into server:/etc/httpd/modules/mod_jk.so: failEdTo map segment from shared object: PeRmIssion denied
Solution:
1) ExecutionLs-Z/etc/httpd/modulesCommandIt is found that the sub-relation of mod_jk.so is very different from that of other so files (I will not map it here );
2) ExecutionChmod755 mod_jk.so
3) Run chcon-t httpd_modules_t/etc/httpd/modules/mod_jk.so.
Solve the problem !!