centos6.x tomcat7.x 开启http-apr

安装编译依赖包

yum install -y gcc openssl-devel libtool

需要用到的包
apr-1.5.0.tar.gz
apr-iconv-1.2.1.tar.gz
apr-util-1.5.3.tar.gz
tomcat-native-1.1.29-src.tar.gz

tar xvf apr-1.5.0.tar.gz
cd /apr-1.5.0
./configure
make 
make install

安装apr的时候出现

./configure --with-apr=/usr/local/apr
rm: cannot remove `libtoolT': No such file or directory

解决办法:

vim configure

在30126行 #    $RM "$cfgfile" 前面 #注释掉

tar xvf apr-util-1.5.3.tar.gz
cd /apr-util-1.5.3
./configure --with-apr=/usr/local/apr
make
make install

tar cvf apr-iconv-1.2.1.tar.gz
cd /apr-iconv-1.2.1
./configure --with-apr=/usr/local/apr
make
make install

tar xvf tomcat-native-1.1.29-src.tar.gz
cd /tomcat-native-1.1.29-src/jni/native
./configure --with-apr=/usr/local/apr --with-java-home=/usr/java/jdk1.7.0_45/
make
make install

vim tomcat目录下/bin/catalina.sh
添加

JAVA_OPTS='-server -Xms2048m -Xmx2048m -Djava.awt.headless=true -Dfile.encoding=UTF-8'
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
export LD_LIBRARY_PATH


conf目录server.xml 中修改

<Connector port="8080"
 protocol="org.apache.coyote.http11.Http11AprProtocol"
 redirectPort="8443"
 connectionTimeout="20000"
 disableUploadTimeout="true"
 acceptCount="2000"
 enableLookups="false"
 maxThreads="500"
 minSpareThreads="30"
 compression="on"
 compressionMinSize="2048"
 noCompressionUserAgents="gozilla, traviata"
 compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"
 URIEncoding="UTF-8" />

重启tomcat

查看catalina.out
Mar 13, 2014 5:51:18 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.5.0.
Mar 13, 2014 5:51:19 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Mar 13, 2014 5:51:19 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1e-fips 11 Feb 2013)
Mar 13, 2014 5:51:19 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Mar 13, 2014 5:51:19 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Mar 13, 2014 5:51:19 PM org.apache.catalina.startup.Catalina load

出现红色部分 apr安装成功


你可能感兴趣的:(centos6.x tomcat7.x 开启http-apr)