三分钟整合Apache和Tomcat

Posted by zuzhihui in apache on 2008/05/24 with No Comments

在Ubuntu或者Debian下整合Apache和Tomcat非常方便

安装

安装Apache,JDK,Tomcat的过程很简单,一个命令搞定:

在Deiban下:

apt-get install apache2-mpm-worker sun-java6-jdk tomcat5.5-webapps libapache2-mod-jk

在Ubuntu下:

apt-get install apache2-mpm-worker sun-java6-jdk tomcat5.5-webapps libapache2-mod-jk

然后访问本机的80端口,确保apache启动了; 访问本机的8180端口,确保tomcat启动了(Debian/Ubuntu的tomcat默认8180端口)

以上命令把apache的jk插件也安装了,不用编译jk了。jk的配置文件安装在了/etc/libapache2-mod-jk/workers.properties 修改这个文件,修改后的有效内容是:

workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/lib/jvm/java-1.5.0-sun-1.5.0.14
ps=/
worker.list=ajp13_worker
worker.ajp13_worker.port=8009
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13

然后配置apache的配置文件/etc/apache2/apache2.conf,在文件的最后加入:

JkWorkersFile /etc/libapache2-mod-jk/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions ForwardKeySize ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /* ajp13_worker

重新启动apache:

/etc/init.d/apache2 restart

然后用浏览器访问apache,就会出现tomcat的页面了,大功告成!

标签:

Leave a Comment

Back to Top

2007-2017 © 北京瑞豪开源科技有限公司 京ICP备13004995号-2