apache和tomcat的集成 [摘]

一:軟件
1:apache_2.0.54-win32-x86-no_ssl.msi
2:tomcat5.5
3:jk插件mod_jk-1.2.14-apache-2.0.54.so
二:apache配置
1:將mod_jk-1.2.14-apache-2.0.54.so拷貝到apache的安裝目錄下的C:/Apache Group/Apache2/modules目錄
2:修改C:/Apache Group/Apache2/conf/httpd.conf文件
   在其最後加上
LoadModule jk_module modules/mod_jk-1.2.14-apache-2.0.54.so
JkWorkersFile conf/workers2.properties
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
JkMount /* loadbalancer

JkMount /xajob/* loadbalancer

#apache will serve the static picture.
#以下命令意味着所有的圖片將由APACHE解析
JkUnMount /*.jpg loadbalancer 
JkUnMount /*.gif loadbalancer
JkUnMount /*.swf loadbalancer
JkUnMount /*.bmp loadbalancer
JkUnMount /*.png loadbalancer

3:在C:/Apache Group/Apache2/conf/新建workers2.properties文件
內容爲:
#以下爲workers2.propertie的內容
worker.list=loadbalancer,server105,server106
# Define the first node...
worker.server105.port=8009
worker.server105.host=127.0.0.1
worker.server105.type=ajp13
worker.server105.lbfactor=1

#worker.server105.local_worker=1
worker.server105.cachesize=100

# Define the 2nd node...
worker.server106.port=8009
worker.server106.host=127.0.0.1
worker.server106.type=ajp13
worker.server106.lbfactor=1

#worker.server106.local_worker=1
worker.server106.cachesize=100

# Now we define the load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=server105,server106
worker.loadbalancer.sticky_session=1
4:修改修改C:/Apache Group/Apache2/conf/httpd.conf文件
把DirectoryIndex index.html index.html.var改爲DirectoryIndex index.html index.htm index.jsp
Directory "C:/tomcat5/webapp/root/"
DocumentRoot "C:/tomcat5/webapp/root/"
既把Directory   DocumentRoot 改到tomcat的默認目錄
5:重新啓動apache和tomcat
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章