Before has written the lamp platform's construction, including the rear lamp platform integration (but because I published the article is too few entertaining, incredibly is the person evil refers to my article is reproduced, to this I expressed very helpless, itself writes the blog also only to record and to help to need the person, So I'm going to keep this style in the back and post my own blog. This article further describes the integration of Apache server and Tomcat to support JSP. All know is Apache support static page, Tomcat support Dynamic page, we can use Apache+tomcat way to combine their advantages, powerful union, Apache is responsible for forwarding, JSP processing to Tomcat to deal with. That is, Apache specializes in HTTP services, as well as related configuration (such as virtual host, URL forwarding, etc.), while Tomcat is a JSP server that the Apache organization develops under the JSP and servlet standard of service java. Since Apache and Tomcat are Web servers, how to integrate with Apache instead of using Tomcat servers, we know that Tomcat supports servlet and JSP, and that it can be used as a Web server, but when working with a large number of static pages, Tomacat not as good as Apache, as strong as Apache. But Apache as the most popular Web server, although able to efficiently handle static pages, but does not support JSP and servlet, so the common practice is to combine them, so that Apache processing static pages, and the dynamic page request to Tomcat processing, play their respective advantages. By loading the integration module and setting in Apache, Apache is able to transfer requests that are not yours to Tomcat according to the URL.
To make Apache and Tomcat work together, you need a connector to connect them. Connector for performance, configuration convenience has a very important impact, at present there are roughly jk1.x, JK2, Mod_webapp three kinds, JK use is more extensive.
Preparation for the integration of Tomcat and Apache (Note: This environment continues after the Apache compilation is complete)
JDK Installation and testing (JDK is an essential software in the Tomcat environment, because Tomcat is just a servlet/jsp container and the underlying operations require JDK to complete)
[Root@chenyi software]# chmod a+x jdk-6u7-linux-i586.bin
[Root@chenyi software]#./jdk-6u7-linux-i586.bin
environment variable settings (tomcat will look for the installation path of JDK at startup)
[Root@chenyi software]# vi/etc/profile.d/java.sh
export java_home=/software/jdk1.6.0_07
export JRE_HOME=$ Java_home/jre
export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
export path= $JAVA _home/ Bin: $JAVA _home/jre/bin: $PATH
[Root@chenyi software]# chmod 755/etc/profile.d/java.sh
[Root@chenyi software]#./etc/profile
Can test if Java is working correctly
[Root@chenyi software]# java-version
java Version "1.6.0_07"
Java (TM) SE Runtime Environment (build 1.6.0_07- B06)
Java HotSpot (TM) Client VM (build 10.0-b23, mixed mode, sharing)
Testing Java Programs
[Root@chenyi software]# VI Test.java Public
class Test {public
static void Main (String args[]) {
System.out. println ("Hello world!");
}
[Root@chenyi software]# javac Test.java
[Root@chenyi software]# java test
Hello world!
Install Tomcat (Tomcat installation only needs to be unpacked, renamed to move to the appropriate place to complete the installation)
[Root@chenyi lamp]# tar zxf apache-tomcat-6.0.14.tar.gz
[Root@chenyi lamp]# MV Apache-tomcat-6.0.14/software/ Tomcat
Compile generation mod_jk. (This is for more flexible use of the MOD_JK connector, so use the source method to compile the required JK module (in the compilation of the need to specify the APXS path of Apache))
[Root@chenyi lamp]# tar zxf jakarta-tomcat-connectors-1.2.15-src.tar.gz
[Root@chenyi lamp]# CD JAKARTA-TOMCAT-CONNECTORS-1.2.15-SRC
[Root@chenyi jakarta-tomcat-connectors-1.2.15-src]#./configure-- With-apxs=/software/apache2/bin/apxs && make && make install
[Root@chenyi native]# ls/software/ apache2/modules/mod_jk.so
/software/apache2/modules/mod_jk.so