Tomcat与Apache整合配置指南

来自Ubuntu中文
跳到导航跳到搜索

ubuntu apache+tomcat+jdk


1.apt-get install apache2-* php5-* mysql-*

2.apt-get install sun-java6-jdk

  # java -version

3.tar -xzvf apache2-tomcat-*

4.mv apache2-tomcat-* /usr/local/tomcat

5.vi /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.14
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export TOMCAT_HOME=/usr/local/tomcat\


6.source /etc/profile

7./usr/local/tomcat/bin/startup.sh

8.http://ip:8080

9.http://ip

10.整合开始

在tomcat目录的conf文件夹下创建jk2.properties文件,在里面加入

handler.list=channelSocket,request
channelSocket.port=8009


4、修改httpd.conf,一开始它是空的,增加

#Server Name
ServerName 127.0.0.1
#JK config
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
JkMount /*.jsp ajp13_worker
JkMount /*/servlet/ ajp13_worker
JkMount /*.do ajp13_worker 

5、/etc/apache2/sites-available中增加一个文件,文件名随便.

如我的ediskmanage,内容如下:

<VirtualHost *>
  ServerAdmin [email protected]
  DocumentRoot "/opt//webapps"
  ErrorLog "/var/log/apache2/manage_errors.log"
  CustomLog "/var/log/apache2/manage_accesses.log" common
  JkMount /servlet/* ajp13_worker
  #让Apache支持对servlet传送,用以Tomcat解析
  JkMount /*.jsp ajp13_worker
  #让Apache支持对jsp传送,用以Tomcat解析
  JkMount /*.do ajp13_worker
  #让Apache支持对.do传送,用以Tomcat解析
</VirtualHost>

6、执行 sudo a2ensite 文件名

7、sudo /etc/init.d/apache2 reload

8、重启 apache和tomcat即可

没有配置成功