# Now we define the load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=server105,server106
worker.loadbalancer.sticky_session=1
5.修改%APACHE_HOME%\conf\httpd.conf文件
1)找到<IfModule dir_module>标签
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
把DirectoryIndex index.htm 改为DirectoryIndex index.html index.htm index.jsp
2)找到DocumentRoot变量
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
把DocumentRoot修改为Tomcat的默认根目录,即%TOMCAT_HOME%\webapps\ROOT. x修改后结果如下:
DocumentRoot "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT"
注意: 这里使用了url路径格式,用"/"代替了系统文件路径中的"\"
3)找到<Directory>标签。可以找到很多,呵呵。注意标签上面的注释
"把值修改为DocumentRoot变量值"
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
修改后结果如下
<Directory "D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/ROOT">
注意: 这里使用了url路径格式,用"/"代替了系统文件路径中的"\"
4)
在httpd.conf最后加上如下内容,主要是和Tomcat完成任务分配
############################下面为增加的内容############################
LoadModule jk_module modules/mod_jk-apache-2.2.4.so #这里要和下载的connector的名字一致
[加到LoadModule的模块位置,否则有可能出错!!!!]
JkWorkersFile conf/workers.properties #这里要和第三步新建的属性文件名字一致
JkLogFile logs/mod_jk.log #日志保存在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