apache+tomcat

apache 虚拟目录

 

#my virsual dir
Alias /tomcat1 "D:\workspaces\tomcat1\web"
<Directory "D:\workspaces\tomcat1\web">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

 

 

tomcat虚拟目录

conf\Catalina\localhost

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="" docBase="D:\workspaces\tomcat1\web" />

 

 

 

mod_jk.conf

#加载mod_jk Module
LoadModule jk_module modules/mod_jk.so
#指定 workers.properties文件路径
JkWorkersFile conf/workers.properties
#指定那些请求交给tomcat处理,"controller"为在workers.propertise里指定的负载分配控制器
JkMount /* controller
JkUnMount /*.html controller

 

httpd.conf

 

include D:/soft/apache-httpserver/conf/mod_jk.conf

 

 

workers.properties

 

worker.list = controller,tomcat1,tomcat2 #server 列表

#========tomcat1========

worker.tomcat1.port=8009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat1.host=localhost #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1 #server的加权比重,值越高,分得的请求越多

#========tomcat2========

worker.tomcat2.port=9009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat2.host=localhost #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor=3 #server的加权比重,值越高,分得的请求越多


#========controller,负载均衡控制器========
worker.controller.type=lb
worker.controller.balanced_workers=tomcat1,tomcat2 #指定分担请求的tomcat
worker.controller.sticky_session=1

你可能感兴趣的:(apache)