再WINDOWS2000server下整合apache与tomcat的问题!!!!!!非常着急!!!!!!!

mylgl 2003-08-22 04:25:35
我想把WINDOWS2000配置成WEB服务器,用JSP开发,想用APACHE和TOMCAT进行整合,改怎么做!
请给出详细详细的步骤!和说明!
...全文
33 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gzh_seagull 2003-08-23
  • 打赏
  • 举报
回复
测试环境:win2000 pro+apache2.0.47+tomcat4.1.24+jdk1.4

1.安装tomcat;
2.在tomcat/conf/目录下增加jk2.properties 内容如下:(更改目录路径)

##============================================================================================
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED

## WHEN YOU EDIT THE FILE.



## COMMENTS WILL BE _LOST_



## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.



# Override the default port for the socketChannel

# channelSocket.port=8019

# Default:

# channelUnix.file=${jkHome}/work/jk2.socket

# Just to check if the the config is working

shm.file=c:/Apache Group/Apache2/logs/jk2.shm



# In order to enable jni use any channelJni directive

channelJni.disabled = 0

# And one of the following directives:



# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so



# If set to inprocess the mod_jk2 will Register natives itself

# This will enable the starting of the Tomcat from mod_jk2

# apr.jniModeSo=inprocess 这句加上不行
#================================================================================================

3。安装apache。
4。修改apache下conf/httpd.conf:

增加:
LoadModule jk2_module libexec/mod_jk2.dll

Alias /examples "c:/tomcat/webapps/examples"

5。在apache目录下建立libexec目录,下载mod_jk2.dll 放进去。

6。在apache 的conf下增加workers2.properties 内容如下:

##================================================================================================
[logger]

level=DEBUG



[config:]

#file=${serverRoot}/conf/workers2.properties

file=c:/Apache Group/Apache2/conf/workers2.properties

debug=0

debugEnv=0



[uriMap:]

info=Maps the requests. Options: debug

debug=0



# Alternate file logger

#[logger.file:0]

#level=DEBUG

#file=${serverRoot}/logs/jk2.log



[shm:]

info=Scoreboard. Required for reconfiguration and status with multiprocess servers

file=${serverRoot}/logs/jk2.shm

size=1000000

debug=0

disabled=0



[workerEnv:]

info=Global server options

timing=1

debug=0

# Default Native Logger (apache2 or win32 )

# can be overriden to a file logger, useful

# when tracing win32 related issues

#logger=logger.file:0



[lb:lb]

info=Default load balancer.

debug=0



#[lb:lb_1]

#info=A second load balancer.

#debug=0



[channel.socket:localhost:8009]

info=Ajp13 forwarding over socket

debug=0

tomcatId=localhost:8009



#[channel.socket:localhost:8019]

#info=A second tomcat instance.

#debug=0

#tomcatId=localhost:8019

#lb_factor=1

#group=lb

#group=lb_1

#disabled=0



#[channel.un:/opt/33/work/jk2.socket]

#info=A second channel connecting to localhost:8019 via unix socket

#tomcatId=localhost:8019

#lb_factor=1

#debug=0



[channel.jni:jni]

info=The jni channel, used if tomcat is started inprocess



[status:]

info=Status worker, displays runtime informations



[vm:]

info=Parameters used to load a JVM in the server process

#JVM=C:\jdk\jre\bin\hotspot\jvm.dll

OPT=-Djava.class.path=c:/tomcat/bin/tomcat-jni.jar;c:/tomcat/server/lib/commons-logging.jar

OPT=-Dtomcat.home=${TOMCAT_HOME}

OPT=-Dcatalina.home=${TOMCAT_HOME}

OPT=-Xmx128M

#OPT=-Djava.compiler=NONE

disabled=0



[worker.jni:onStartup]

info=Command to be executed by the VM on startup. This one will start tomcat.

class=org/apache/jk/apr/TomcatStarter

ARG=start

disabled=0

stdout=c:/Apache Group/Apache2/logs/stdout.log

stderr=c:/Apache Group/Apache2/logs/stderr.log



[worker.jni:onShutdown]

info=Command to be executed by the VM on shutdown. This one will stop tomcat.

class=org/apache/jk/apr/TomcatStarter

ARG=stop

disabled=0



[uri:/jkstatus/*]

info=Display status information and checks the config file for changes.

group=status:



#[uri:127.0.0.1:8003]

#info=Example virtual host. Make sure myVirtualHost is in /etc/hosts to test it

#alias=myVirtualHost:8003



#[uri:127.0.0.1:8003/ex]

#info=Example webapp in the virtual host. It'll go to lb_1 ( i.e. localhost:8019 )

#context=/ex

#group=lb_1



[uri:/examples]

info=Example webapp in the default context.

context=/examples

debug=0



#[uri:/examples1/*]

#info=A second webapp, this time going to the second tomcat only.

#group=lb_1

#debug=0



[uri:/examples/servlets/*]

info=Prefix mapping



[uri:/examples/*.jsp]

info=Extension mapping



[uri:/examples/*]

info=Map the whole webapp



[uri:/examples/servlets/HelloW]

info=Exampel with debug enabled.

debug=10

##=======================================================================================================

7。调试,启动apache,了;浏览http://hans:82/examples/ 看到tomcat下的内容,成功!

8。如果不想用examples,想自己新建自己的项目目录,则:
加入自己的项目 :
a.在SERVER.XML中加入:

<!-- Tomcat hans Context ; hans add it-->
<Context path="/hans" docBase="hans"
debug="0" privileged="true"/>


b.在HTTP.CONF中加入:
Alias /hans "c:/tomcat/webapps/hans"

c.在workers2.properties中加入:

##==============================hans add for a new perject=========
[uri:/hans]

info=Example webapp in the default context.

context=/hans

debug=0


[uri:/hans/servlets/*]

info=Prefix mapping



[uri:/hans/*.jsp]

info=Extension mapping



[uri:/hans/*]

info=Map the whole webapp



[uri:/hans/servlets/HelloW]

info=Exampel with debug enabled.

debug=10


#==========================================##

就可以了。



24,922

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧