1、准备,下载需要的文件。这里假定你已经正确安装配置好了JDK。 httpd-2.2.0.tar.gz 其中httpd和jakarta-tomcat-connectors为源码包,apache-tomcat为二进制包。
# cd httpd-2.2.0 # ./configure --prefix=/usr/local/apache2 --enable-so # make # make install
.安装apache: 编译:./configure --prefix=/usr/local/apache2 --enable-rewrite=shared --enable-proxy=shared make make install 后面要跟参数enable-proxy,否则无法代理tomcat。
# cd /usr/local # tar xzvf apache-tomcat-5.5.12.tar.gz # ln -s apache-tomcat-5.5.12 tomcat
# cd jakarta-tomcat-connectors-1.2.15-src/jk/native # ./configure --with-apxs=/usr/local/apache2/bin/apxs # make # cp ./apache-2.0/mod_jk.so /usr/local/apache2/modules/
JkWorkersFile /usr/local/apache2/conf/workers.properties
JkLogFile /usr/local/apache2/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /servlet/* worker1 #识别/servlet/* 开头的servlet JkMount /*.jsp worker1 #识别/下所有jsp文件 JkMount /* worker1 #识别tomcat下的上下文
worker.list=worker1
worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300 DocumentRoot "/var/wwwroot" 增加关于加载mod_jk的语句:
Include /usr/local/apache2/conf/mod_jk.conf
<Context path="" docBase="/var/wwwroot" debug="0" reloadable="true" crossContext="true"/> 在/var/wwwroot下建立一个index.jsp,启动Apache和Tomcat,用浏览器访问http://localhost/ ,应该可以看到正确的 页面了。 查考文章:http://hi.baidu.com/8495138/blog/item/0942243423f05d3a5bb5f5b1.html 转载 |