一台机器的IP:192.168.1.107,系统是windowsXP,在这台机器上安装for windows版本的apache。 另一台机器IP:192.168.1.202,安装的系统是Linux ES 3.0,在这台机器上安装tomcat。
apache在安装的过程中提示web服务器使用的端口,可选项是80和8080,这里最好是选80端口,因为只有你选了80端口在服务控制台里会增加apache的服务项,并且在启动、停止apache服务可以使用apache自带的“apache service monitor”,否则,你在安装时选的是8080端口的话,只能从dos窗口来启动apache,即便你后来把web服务端口配置成80也不能在服务控制台添加apache服务项。
# Shared memory handling. Needs to be set. [shm] info=Scoreboard. Required for reconfiguration and status with multiprocess servers file="D:\Program Files\Apache Group\Apache2\conf\jk2.shm" size=1048576 debug=0 disabled=0
# Windows domain socket [channel.socket:192.168.1.202:8009] port=8009 host=192.168.1.202
# define the worker #[ajp13:/opt/tomcat/work/jk2.socket] #channel=channel.un:/opt/tomcat/work/jk2.socket [ajp13:192.168.1.202:8009] channel=channel.socket:192.168.1.202:8009
# Uri mapping for MyFirst [uri:/servlets-examples/*]
[uri:/jsp-examples/*] [uri:/tomcat-docs/*]
至此,我的机器107这端的apache就配置好了,下面来登陆到202机器上,看看202上tomcat的配置: 在202机器上进入到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.
# Set the desired handler list # handler.list=apr,request,channelJni # # 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=/usr/local/tomcatzdmtest/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 # list of needed handlers. handler.list=apr,channelSocket,request
# Override the default port for the channelSocket channelSocket.port=8009