Apache and Tomcat integration, configuration and compression

 

1. Download Apache2 and the corresponding mod_jk.so, copy mod_jk.so to the E:\Apache2.2\ modules\ folder

2. Create E:\Apache2.2\conf\workers.properties

 

workers.tomcat_home=E:/JAVA/Tomcat7_8888
workers.java_home=E:/ProgramFiles/Java/jre7
ps=\
#Specify file path separator
worker.list=ajp13
worker.ajp13.port=8089
#Working port, this port should match the port used by the AJP/1.3 protocol of the Connector element in server.xml
worker.ajp13.host=zfei.com
#address of the Tomcat server
worker.ajp13.type=ajp13
#Types of
worker.ajp13.lbfactor=1
# load balancing factor

 3. Add at the end of E:\Apache2.2\conf\httpd.conf,

 

LoadModule jk_module modules\mod_jk-1.2.26-httpd-2.2.4.so
#The file of mod_jk here is the file you downloaded
JkWorkersFile   conf\workers.properties
#Specify the address of the tomcat listening configuration file
JkLogFile  logs\mod_jk2.log
#Specify the log storage location
JkLogLevel info

#compression
#Add deflate module for enable GZIP function
LoadModule deflate_module     modules/mod_deflate.so
#Set compression level
DeflateCompressionLevel 9
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/jsp
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/gif image/png  image/jpe image/swf image/jpeg image/bmp
#Hook on output filter
SetOutputFilter DEFLATE

#Set up virtual host
<VirtualHost *>
#If it is not a virtual host, comment or delete <VirtualHost localhost> and the last </VirtualHost>
ServerAdmin zfei.com
DocumentRoot E:/JAVA/Tomcat7_8888/webapps
DirectoryIndex index.html index.htm index.jsp
JkMount /* ajp13 #ajp13 corresponds to worker.list=ajp13 in workers
</VirtualHost>

 , which is parsed by Tomcat

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326865910&siteId=291194637