Integration Preparation:
1, Apache HTTP Server (hereinafter abbreviated with Apache)
2, Tomcat 7 or 8
3, mod_jk.so (tomcat-connectors)-This file is used to link the HTTP server with Tomcat Bridge
: http://mirrors.hust.edu.cn/apache/tomcat/tomcat-connectors/jk/binaries/windows/
The downloaded version is identical to the Apache version
Apache installation is the next step, but there is a place to enter the fill
Install the location of your choice, my installation at: D:\Apache\HttpServer\Apache2.2
TOMCA installation is not introduced: Unzip one or the installation version of the line
Apache and TOMCA Integration:
1. Unzip the downloaded tomcat-connectors-1.2.40-windows-i386-httpd-2.2.x (my Apache is 2.2.25) and find
mod_jk.so file and copy it to the Modules folder in the Apache installation directory
2, open the Apache installation directory, the main configuration is concentrated in the Conf folder under the httpd.conf file, location:
(1) Modify DocumentRoot
DocumentRoot generally for JS, CSS, HTML, PNG, GIF, JPG and other static resource file storage directory, where we define the D:/apache/httpserver/www folder. The revised content is as follows:
DocumentRoot "D:/apache/httpserver/www"
Create a file under it that is identical to the project Webroot copy the static files.
(2) figure is as follows: line 193th, change the Deny from all to allow from all otherwise access the static file when the page prompts Forbidden to prohibit access to the information.
(3) Directory modified to the same value as DocumentRoot
(4) Comment out the options Indexes followsymlinks and append a line to the options None. The role and the listings in Conf/web.xml under Tomcat are set to false, in order to avoid listing the directory structure of the server-side resources in the browser.
3.Apache Associated TOMCAT configuration
Create a new Workers.properties file in the Conf folder (the folder where httpd.conf is located) with the following contents:
workers.tomcat_home=d:/apache/apache-tomcat-8.0.9
workers.java_home=c:/java/jdk1.8.0
ps=/
Worker.list=ajp13
worker.ajp13.port=8009
Worker.ajp13.host=localhost
Worker.ajp13.type=ajp13
At the very end of the httpd.conf (that is,
<ifmodule ssl_module>
Sslrandomseed Startup Builtin
Sslrandomseed Connect Builtin
After </IfModule>) add a piece of code
# #wen #
LoadModule Jk_module modules/mod_jk.so
Jkworkersfile conf/workers.properties
Jklogfile Logs/mod_jk.log
<virtualhost *>
ServerAdmin localhost
DocumentRoot d:/apache/httpserver/www
ServerName 127.0.0.1:80
DirectoryIndex index.html index.htm index.jsp login.jsp
Errorlog Logs/shsc-error_log.txt
Customlog Logs/shsc-access_log.txt Common
Jkmount/*web-inf ajp13
jkmount/manage/* ajp13
jkmount/captchaimageaction/* ajp13
Jkmount/*.jsp ajp13
Jkmount/*.do ajp13
</VirtualHost>
To filter those requests to Tomcat for processing.
Add:
Configuration of multiple Tomcat
1. Configure the Workers.properties file under Apache's conf directory
# list the workers by name
#worker. list=dlog4j, status, TOMCAT3, TOMCAT4,TOMCAT5
worker.list=dlog4j, status, TOMCAT1
# localhost server 1
# ------------------------
worker.tomcat1.port=8009
Worker.tomcat1.host=localhost
Worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=100
# localhost server 2
# ------------------------
#worker. tomcat2.port=8010
#worker. Tomcat2.host=localhost
#worker. tomcat2.type=ajp13
#worker. tomcat2.lbfactor=100
# localhost server 3
# ------------------------
#worker. tomcat3.port=8009
#worker. tomcat3.host=xxxxxx
#worker. tomcat3.type=ajp13
#worker. tomcat3.lbfactor=100
# localhost Server 4
# ------------------------
#worker. tomcat4.port=8010
#worker. tomcat4.host=xxxxxx
#worker. tomcat4.type=ajp13
#worker. tomcat4.lbfactor=100
# localhost Server 5
# ------------------------
#worker. tomcat5.port=8011
#worker. tomcat5.host=xxxxxx
#worker. tomcat5.type=ajp13
#worker. tomcat5.lbfactor=100
#worker. Dlog4j.type=lb
#worker. Dlog4j.balance_workers=tomcat3,tomcat4,tomcat5
#default session is True
#worker. Dlog4j.sticky_session=true
Worker.status.type=status
This configuration is commented out, including the load balancer settings, currently only support a TOMCAT1, integrated with Apache
2, configure Apache conf directory, add uriworkermap.properties file
/*=dlog4j
/jkstatus=status
!/*.gif=dlog4j
!/*.jpg=dlog4j
!/*.png=dlog4j
!/*.css=dlog4j
!/*.js=dlog4j
!/*.htm=dlog4j
!/*.html=dlog4j
!/*.php=dlog4j
3. Modify the Conf file http.conf
LoadModule Jk_module modules/mod_jk.so
<ifmodule jk_module>
Jkworkersfile conf/workers.properties
Jkmountfile conf/uriworkermap.properties
Jklogfile Logs/mod_jk.log
Jkloglevel warn
</IfModule>