apache 2 tomcat5.5
1. 现在用jk1.2.x 连接,修改httpd.conf
LoadModule jk_module modules/mod_jk.so
2. 设置apache中的中文
AddDefaultCharset=GB2312
3. 设置DocumentRoot为 /opt/tomcat55/webapps/ROOT
4. 设置ROOT/index.jsp中需要的虚拟目录
Alias /tomcat-docs "/opt/tomcat55/webapps/tomcat-docs/"
<Directory "/opt/tomcat55/webapps/tomcat-docs">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
设置的时候一定不能设为 /tomcat-docs/ 这标识是不同的
4. 在httpd.conf最后加上
JkMount /*.jsp worker1
JkMount /*.jspx worker1
JkLogFile logs\mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkWorkersFile conf/workers.properties
5. 在/etc/httpd/conf目录下 创建workers.properties,内容如下
# Define 1 real worker using ajp13
workers.tomcat_home="/opt/tomcat55"
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.reclycle_timeout=300
6. 在tomcat的ROOT的目录下用如下index.jsp 转到其他目录
<%@page contentType="text/html;charset=gb2312"%>
<%@ page import="java.io.*"%>
<%
response.sendRedirect("xxxx/index.htm");
%>
7. 同时要修改tomcat ROOT\WEB-INF中的 web.xml,将 servlet 去除