标签:des style class java http tar
jk connecteor连接器下载地址
http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/
具体搞定策略步骤
1,安装httpd,基于yum安装
yum install httpd httpd-devel(安装成功后,会有/usr/sbin/apxs服务,mod_jk的编译依赖于apxs)
2,部署tomcat,基于官网二进制包安装,(很很简单)
3,开始基于mod_jk方式整合httpd与tomcat
下载tomcat-connector
wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.32-src.tar.gz
mv tomcat-connectors-1.2.32 /opt/mod_jk
cd /opt/mod_jk/native
./configure--with-apxs=/usr/sbin/apxs --with-java-home=/opt/java
Make
Make install
复制mod_jk.so
cp/opt/mod_jk/native/apache-2.0/mod_jk.so /usr/lib64/httpd/modules/
修改httpd配置
创建workers.properties
vim /etc/httpd/conf/workers.properties 添加以下内容:
# Defining a workernamed worker1 and of type ajp13
worker.list=worker1
# Set properties forworker1
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
创建 mod_jk.conf
vim /etc/httpd/conf/mod_jk.conf 添加以下内容:
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk logs
JkLogFile/etc/httpd/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 tosend SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat-ForwardDirectories
# JkRequestLogFormat setthe request format
JkRequestLogFormat"%w %V %T"
# 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理
JkMount /servlet/* worker1
JkMount /*.jsp worker1
修改httpd.conf
vim httpd.conf 修改以下内容
ServerName修改为:ServerName 10.11.18.45:80
DirectoryIndex 行添加 index.jsp index.htm
添加以下内容,其中”/var/wwwroot”是你要发布的Web项目所在的父目录
DocumentRoot"/var/wwwroot"
<Directory"/var/wwwroot">
Options Includes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
XBitHack on
</Directory>
<Directory"/var/wwwroot/WEB-INF">
Order deny,allow
Deny from all
</Directory>
以下内容:添加
LoadModule jk_module/usr/lib64/httpd/modules/mod_jk.so Include/etc/httpd/conf/mod_jk.conf
修改tomcat的配置
vim $TOMCAT_HOME/conf/server.xml
将 <Server …>部分 修改为 <Hostname="localhost" appBase="/var/wwwroot" unpackWARs="true"autoDeploy="true">
restart httpd 和 tomcat
/etc/init.d/httpd restart
$TOMCAT_HOME/bin/shutdown.sh
$TOMCAT_HOME/bin/startup.sh
测试
在/var/wwwroot 目录下新建目录myproject,m yproject下新建index.jsp
<%@ page language="java" import="java.util.*"pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath =request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<basehref="<%=basePath%>">
<title>My JSP ‘index.jsp‘ startingpage</title>
<meta http-equiv="pragma"content="no-cache">
<metahttp-equiv="cache-control" content="no-cache">
<meta http-equiv="expires"content="0">
<metahttp-equiv="keywords" content="keyword1,keyword2,keyword3">
<metahttp-equiv="description" content="This is my page">
<!--
<link rel="stylesheet"type="text/css" href="styles.css">
-->
</head>
<body>
Hello, I am mango_song ,this is my JSPpage. <br>
</body>
</html>
httpd与tomcat基于mod_jk整合,布布扣,bubuko.com
标签:des style class java http tar
原文地址:http://www.cnblogs.com/ruiy/p/combie.html