标签:apache
apache-tomcat的配置
首先下载软件包
apache-tomcat-6.0.33.tar.gz tomcat-connectors-1.2.32-src.tar.gz
httpd-2.2.17.tar.gz jdk-6u25-linux-i586-rpm.bin
1.安装JDK
chmod +x jdk-6u25-linux-i586.bin
./jdk-6u25-linux-i586.bin
mkdir /usr/java
mv jdk1.6.0_25/ /usr/java/
设置环境变量
vi /etc/profile 在最后添加:
export JAVA_HOME=/usr/java/jdk1.6.0_25
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
source /etc/profile 使设置立即生效
2.安装apache
tar -xvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/apache --enable-so
make;make install
3.安装tomcat
tar -xvf apache-tomcat-6.0.33.tar.gz -C /usr/local/
cd /usr/local/
ln -sv apache-tomcat-6.0.33/ tomcat6
vi tomcat6/bin/setenv.sh 如果没有这个文件手动建立
JAVA_HOME=/usr/java/jdk1.6.0_25
KRE_HOME=/usr/java/jdk1.6.0_25/jre
创建一个用户,可以通过web页面登录进行管理, 创建用户要卸载<!--...>外面
vi /usr/local/tomcat6/conf/tomcat-users.xml
<user username="michael" password="123456" roles="manager,admin"/>
测试tomcat安装 http://localhost:8080
4.连接apache和tomcat
1)编译生成mod_jk.so
tar -xvf tomcat-connectors-1.2.32-src.tar.gz
cd tomcat-connectors-1.2.32-src/native
./configure --with-apxs=/usr/local/apache/bin/apxs --with-java-home=/usr/java/jdk1.6.0_25/
make;make install
验证:在ls /usr/local/apache/modules/应该能看到mod_jk.so模块生成
2)让apache支持jk模块
vi /usr/local/apache/conf/httpd.conf
DirectoryIndex index.jsp index.html
LoadModule jk_module modules/mod_jk.so
Include conf/extra/mod_jk.conf
vi /usr/local/apache/conf/extra/mod_jk.conf
# 指出mod_jk模块工作所需要的工作文件workers.properties的位置
JkWorkersFile /usr/local/apache2/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/apache2/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat>来处理
JkMount /servlet/* worker1
JkMount /*.jsp worker1
JkMount *.do Worker1
AddType application/x-jsp .jsp
vi /usr/local/apache/conf/workers.properties
# Defining a worker named worker1 and of type ajp13
worker.list=worker1
# Set properties for 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
3)修改tomcat和apache指向同一个网页根目录
vi /usr/local/tomcat6/conf/server.xml
<Context path="" docBase="/usr/local/apache/htdocs"
debug="0" reloadable="true" crossContext="true"/>
在apache的网页根目录下面建立测试页面
<html>
<body>
<h1>JSP Test Page</h1>
<%=new java.util.Date()
%>
</body>
</html>
linux下apache+tomcat的配置实现
标签:apache
原文地址:http://blog.csdn.net/hopezhangbo/article/details/38010283