Apach2 与Tomcat 负载配置

(1)
下载JK
地址: http://tomcat.apache.org/connectors-doc/
(2)
修改apache httpd.conf,引入 mode_jk
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile F:/apache/logs/jk.log
JkLogLevel error

(3)
配置组属性 workers.properties
worker.list=Catalina
worker.Catalina.type=ajp13
worker.Catalina.host=www.abc.com
worker.Catalina.port=8009  #ajp 端口号 与tomcat一致 
worker.Catalina.lbfactor=50


(4)
修改apache httpd.conf,配置域名
<VirtualHost 127.0.0.1:80>
    ServerAdmin  [email protected]
    DocumentRoot "E:/webroot/abc"
    DirectoryIndex index.jsp
    ServerName  abc.com
    ServerAlias abc.com www.abc.com
    ErrorLog F:/pache/logs/jk_error.log
    CustomLog F:/apache/logs/jk_access.log common
    JkMount /*.jsp Catalina
    JkMount /*.action Catalina
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^abc.com
    RewriteRule ^(.*)$ http://www.abc.com$1 [R=permanent,L]
</VirtualHost>

你可能感兴趣的:(tomcat)