| 配置Apache
# vi /usr/local/apache/conf/httpd.conf
1、在文件加载模块的位置加上如下语句
LoadModule jk_module modules/mod_jk.so
2、在文件最末尾加上如下语句
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile 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”
# Send servlet for context /examples to worker named ajp13
# JkMount /servlet/* ajp13
# Send JSPs for context /examples to worker named ajp13
JkMount /*.jsp ajp13
# Apache 虚拟主机配置
NameVirtualHost *:80
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot “/usr/local/tomcat/webapps” ServerName 192.168.1.5 ErrorLog logs/localhost-error_log CustomLog logs/localhost-access_log common </VirtualHost>
配置workers.properties文件
#vi /usr/local/apache/conf/workers.properties
在文件中添加如下内容:
worker.list=ajp13
worker.ajp13.port=8009
# 本机,若上面Tomcat主机不为localhost,作相应修改
worker.ajp13.host=192.168.1.5
# 类型
worker.ajp13.type=ajp13
# 代理数,不用修改
worker.ajp13.lbfactor=1
8009端口的中文支持
# vi /usr/local/tomcat/conf/server.xml
设置URIEncode为UTF-8,以支持中文
<Connector port=”8009″ URIEncoding=”UTF-8″ …/>
|