Tomcat与Apache整合配置指南:修订间差异
来自Ubuntu中文
跳到导航跳到搜索
无编辑摘要 |
无编辑摘要 |
||
(未显示同一用户的2个中间版本) | |||
第2行: | 第2行: | ||
-------------------------------------------------------------------- | -------------------------------------------------------------------- | ||
1.apt-get install apache2-* php5-* mysql-* | 1.apt-get install apache2-* php5-* mysql-* | ||
2.apt-get install sun-java6-jdk | 2.apt-get install sun-java6-jdk | ||
# java-version | |||
# java -version | |||
3.tar -xzvf apache2-tomcat-* | 3.tar -xzvf apache2-tomcat-* | ||
4.mv apache2-tomcat-* /usr/local/tomcat | 4.mv apache2-tomcat-* /usr/local/tomcat | ||
5.vi /etc/profile | 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 JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.14 | ||
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib | export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin | ||
export TOMCAT_HOME=/usr/local/tomcat\ | export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib | ||
export TOMCAT_HOME=/usr/local/tomcat\ | |||
6.source /etc/profile | 6.source /etc/profile | ||
7./usr/local/tomcat/bin/startup.sh | 7./usr/local/tomcat/bin/startup.sh | ||
8.http://ip:8080 | 8.http://ip:8080 | ||
9.http://ip | 9.http://ip | ||
10. | |||
整合开始 | 10.整合开始 | ||
在tomcat目录的conf文件夹下创建jk2.properties文件,在里面加入 | 在tomcat目录的conf文件夹下创建jk2.properties文件,在里面加入 | ||
handler.list=channelSocket,request | handler.list=channelSocket,request | ||
channelSocket.port=8009 | channelSocket.port=8009 | ||
4、修改httpd.conf,一开始它是空的,增加 | 4、修改httpd.conf,一开始它是空的,增加 | ||
#Server Name | #Server Name | ||
ServerName 127.0.0.1 | 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,内容如下: | 如我的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 | |||
</VirtualHost> | #让Apache支持对servlet传送,用以Tomcat解析 | ||
JkMount /*.jsp ajp13_worker | |||
#让Apache支持对jsp传送,用以Tomcat解析 | |||
JkMount /*.do ajp13_worker | |||
#让Apache支持对.do传送,用以Tomcat解析 | |||
</VirtualHost> | |||
6、执行 sudo a2ensite 文件名 | 6、执行 sudo a2ensite 文件名 | ||
7、sudo /etc/init.d/apache2 reload | 7、sudo /etc/init.d/apache2 reload | ||
8、重启 apache和tomcat即可 | 8、重启 apache和tomcat即可 | ||
没有配置成功 | 没有配置成功 |
2011年12月22日 (四) 08:16的最新版本
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
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即可
没有配置成功