Apache + Jboss3.0.7 + Tomcat4.1.x (for win2000 pro)配置

类别:Java 点击:0 评论:0 推荐:

Apache + Jboss3.0.7 + Tomcat4.1.x (for win2000 pro)配置

一.安装

条件:(所有软件版本很关键,请按列出的版本安装成功再更换其它版本)

Apache:apache_2.0.48-win32-x86-no_ssl.msi(http://apache.linuxforum.net/dist/httpd/binaries/win32/apache_2.0.48-win32-x86-no_ssl.msi)

 

Jboss:jboss-3.0.7_jakarta-tomcat-4.1.24(两者集成版,网上找找,会有的)

 

Mod_jk:mod_jk_1.2.5_2.0.47.dll(http://apache.linuxforum.net/dist/jakarta/tomcat-connectors/jk/binaries/win32/mod_jk_1.2.5_2.0.47.dll)

 

二.配置Apache与Mod_jk

copy mod_jk_1.2.5_2.0.47.dll 文件至 apache_install_dir/modules

编辑apache_install_dir/conf/httpd.conf文件,在最后一行加入

 

#--------------------------begin------------------

LoadModule jk_module modules/mod_jk_1.2.5_2.0.47.dll

 

<IfModule mod_jk.c>

JKWorkersFile "C:\Apache2\conf\workers.properties"

JKLogFile "C:\Apache2\logs\jk.log"

JKLogLevel normal

JKMount /*.jsp lb

</IfModule>

 

#------------------------end---------------------

 

我的apache装在C:\Apache2目录下

要注意JKMount /*.jsp lb,如果此处写成JKMount /* lb,将所有的文件将直接转到jboss发布目录去搜索,我们这里的设置只过滤jsp文件,其它文件还是去apachel配置的DocumentRoot路径里找,所以我还要设置DocumentRoot,之所以这样作是为了我们能够使用apache的alias别名功能。

 

找到DocumentRoot "C:/Apache2/htdocs"行,把它改为:

DocumentRoot "C:/jboss-3.0.7_jakarta-tomcat-4.1.24/server/all/deploy/mms.war"

 

如果要使用servlet,可以加上JKMount /servlets/* lb,当然还要在web.xml里的servlet 的url都改为如

<servlet>

    <servlet-name>MyServlet</servlet-name>

    <servlet-class>com.common.ConsoleServlet</servlet-class>

  </servlet>

<servlet-mapping>

    <servlet-name> MyServlet </servlet-name>

    <url-pattern>/servlets/myservlet</url-pattern>

  </servlet-mapping>

在IE里录入http://192.168.0.28/servlets/myservlet 就可以执行ConsoleServlet了

三.配置workers.properties文件

编辑以下内容存为workers.properties文件,在C:\Apache2\conf目录下

#-------------------begin-------------------------------

# tell mod_jk to use the load balancer

worker.list=lb

 

# define the worker1

worker.worker1.type=ajp13

worker.worker1.host=192.168.0.28

worker.worker1.port=8009

worker.worker1.lbfactor=1

 

# define the worker2

worker.worker2.type=ajp13

worker.worker2.host=192.168.0.28

worker.worker2.port=8009

worker.worker2.lbfactor=1

 

# define the load balancer

worker.lb.type=lb

worker.lb.balanced_workers=worker1,worker2

 

#---------------------end-------------------------

 

192.168.0.28为我的电脑IP是地址,当然jboss也在本机上

This workers.properties file defines two workers. You should define a worker for each JBoss node you want to forward requests to.

 

 

四.     置jboss的tomcat41-service.xml文件

在C:\jboss-3.0.7_jakarta-tomcat-4.1.24\server\all\deploy目录,当然你有default也行

把原来的Connector注释掉,并添加新的Connector,改为以下内容(包括已注释的)

 

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->

<!--Connector className="org.apache.coyote.tomcat4.CoyoteConnector"

               port="80" minProcessors="5" maxProcessors="75"

               enableLookups="true" redirectPort="8443"

               acceptCount="100" debug="0" connectionTimeout="-1"

               useURIValidationHack="false" disableUploadTimeout="true" /-->

 

<!-- An AJP 1.3 Connector on port 8009. Used by Apache mod_jk for example -->          

<!--Connector className="org.apache.coyote.tomcat4.CoyoteConnector"

               port="8009" minProcessors="5" maxProcessors="75"

               enableLookups="true" redirectPort="8443"

               acceptCount="10" debug="0" connectionTimeout="20000"

               useURIValidationHack="false"

               protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/-->

           

<!-- A HTTP Connector on port 8080 -->

<Connector className = "org.apache.catalina.connector.http.HttpConnector"

               port = "8080" minProcessors = "3" maxProcessors = "10" enableLookups = "true"

               acceptCount = "10" debug = "0" connectionTimeout = "60000"/>

              

<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"

               port="8009" minProcessors="5" maxProcessors="75"

acceptCount="10" />

      

       端口8080可改为其它端口,但不可改为80, 因apache正在使用,8090端口修改要与workers.properties一致。

 

五.大功告成

       重启apache

       启动jboss_tomat (C:\jboss-3.0.7_jakarta-tomcat-4.1.24\bin\run –c all)\bin\run –c all)

       在IE里录入http://localhost 或http://localhost/jmx-console/ 正常显示,一切OK

 

六、别名配置

       找到以下行

AliasMatch ^/manual(?:/(?:de|en|fr|ja|ko|ru))?(/.*)?$ "C:/Apache2/manual$1"

 

<Directory "C:/Apache2/manual">

    Options Indexes

    AllowOverride None

    Order allow,deny

    Allow from all

 

    <Files *.html>

        SetHandler type-map

    </Files>

 

    SetEnvIf Request_URI ^/manual/de/ prefer-language=de

    SetEnvIf Request_URI ^/manual/en/ prefer-language=en

    SetEnvIf Request_URI ^/manual/fr/ prefer-language=fr

    SetEnvIf Request_URI ^/manual/ja/ prefer-language=ja

    SetEnvIf Request_URI ^/manual/ko/ prefer-language=ko

    SetEnvIf Request_URI ^/manual/ru/ prefer-language=ru

    RedirectMatch 301 ^/manual(?:/(de|en|fr|ja|ko|ru)){2,}(/.*)?$ /manual/$1$2

</Directory>

 

在其底下加上

Alias /mig/ "D:/Temp/"

   <Directory "D:/Temp/">

       Options Indexes FollowSymLinks MultiViews

       AllowOverride None

       Order allow,deny

       Allow from all

   </Directory>

 

这样你就可以通过http://192.168.0.28/mig/ 来访问了,如果D:/Temp目录下有index.html文件就可直接显示了

本文地址:http://com.8s8s.com/it/it16880.htm