Integrating Apache-2.2.29 with Tomcat-6.0.41, tomcat6.0.41 in CentOS-6.4-minimal
/*** CentOS-6.4-minimal integrates Apache-2.2.29 with Tomcat-6.0.41 * versions * AJP (Apache JServer Protocol) through a JK-1.2.40) * Tomcat provides special JK plug-ins to communicate with Tomcat and HTTP servers (such as Apache, Nginx, and IIS, that is, we often see that after mod_jk * jk is installed on the HTTP server of the other party, when the HTTP server receives a customer request, it filters the URL through jk, jk determines whether to forward the request to Tomcat based on the pre-configured URL ing information. * jk implements communication between apache and tomcat through the AJP protocol, the AJP protocol is a customized protocol for communication between Tomcat and HTTP servers. It can provide high communication speed and efficiency. * ajp12 has been deprecated and is currently using version 1.3, the ajpv13 protocol is a packet-oriented * Web server and Servlet container that interact over TCP connections. To save the expensive cost of socket creation, the Web server will try to maintain a permanent TCP connection to the Servlet container * and reuse this connection in the Process of multiple requests and response cycles. Once a connection is assigned to a specific request, therefore, the connection cannot be reused before the request processing period ends. * In general, this is because of the following two reasons, the efficiency of communication using the AJP protocol is higher than that of the HTTP protocol * 1) The ajp adopts a persistent connection, which ensures the communication between Tomcat and the HTTP server and reduces the overhead of establishing a TCP connection * 2) ajp uses a certain protocol format, reduces the size of the data transmitted packets, saving the bandwidth * ---------------------------------------------------------------------------------------------------------------------- * install JK-1.2.40 * 1) to specify the location of apxs in the apache installation directory during installation, it allows us to dynamically load modules. After installation, a mod_jk.so file is generated under the modules directory of apapche * 2) If autoconf or libtool not found is prompted during installation, then yum-y install autoconf or libtool * [root @ CentOS64 software] # tar zxvf tomcat-connectors-1.2.40-src.tar.gz * [root @ CentOS64 software] # cd tomcat-connectors-1.2.40-src/native/* [root @ CentOS64 native] #. /buildconf. sh * [root @ CentOS64 native] #. /configure -- with-apxs =/app/apache/bin/apxs * [root @ CentOS64 native] # make * [root @ CentOS64 native] # make install * [root @ CentOS64 native] # ll/app/apache/modules/* ---------------------------------------------------------------------------------------------------------------------- * install Tomcat-6.0.41 * Without compiling source code, directly extract the [tar zxvf apache-tomcat-6.0.41.tar.gz], and then execute/app/tomcat/bin/startup. sh can start Tomcat * ---------------------------------------------------------------------------------------------------------------------- * configure Tomcat * 1) Disable HTTP protocol * Comment server. <Connector port = "8080" protocol = "HTTP/1.1" connectionTimeout = "20000" redirectPort = "8443"/> * 2) Enable the AJP protocol * to keep the server. <Connector port = "8009" protocol = "AJP/1.3" redirectPort = "8443"/> * ---------------------------------------------------------------------------------------------------------------------- * configure Apache * 0) for installation of Apache, see http://blog.csdn.net/jadyer/article/details/39583879 * 1) modify/app/apache/conf/httpd. conf file * enable VM --> uncomment Include conf/extra/httpd-vhosts.conf * Add JK configuration ---> Add a line Include conf/extra/httpd-jk.conf * 2) create the/app/apache/conf/extra/httpd-jk.conf file and add the following content * LoadModule jk_module modules/mod_jk.so * JkWorkersFile conf/workers. properties * JkLogFile logs/mod_jk.log * JkLogLevel info * 3) Create/app/apache/conf/workers. properties file, and add the following content * worker. list = tomcat * worker. tomcat. type = ajp13 * worker. tomcat. host = 192.168.0.103 * worker. tomcat. port = 8009*4) modify the/app/apache/conf/extra/httpd-vhosts.conf file and add the following content (you can use the # To comment out the original two <VirtualHost *: 80/> default configuration) * <VirtualHost *: 80> * ServerName "www.jadyer.com" * DocumentRoot "/app/tomcat/webapps/docs" * ErrorLog "logs/www.jadyer.com-error. log "* CustomLog" logs/www.jadyer.com-access. log "common * <Directory"/app/tomcat/webapps/docs "> * Options FollowSymLinks * AllowOverride None * Order allow, deny * Allow from all * </Directory> * JkMount/* tomcat * JkUnMount /*. html tomcat * JkUnMount /*. jpg tomcat * JkUnMount /*. css tomcat * JkUnMount/css/* tomcat * JkUnMount/js/* tomcat * JkUnMount/lib/* tomcat * </VirtualHost> * optional * @ create Sep 27,201 4 1:39:24 *@ author Xuan Yu