#环境:centos7 + jdk1.8 + tomcat8
#安装前置依赖
yum install -y apr-devel openssl-devel gcc make expat-devel
#安装apr
cd /usr/local
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.5.tar.gz
tar -xvf apr-1.6.5.tar.gz
cd apr-1.6.5
./configure
make
make install
#不能报错!!!
#安装apr-util
cd /usr/local
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar –xvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --with-apr=/usr/local/apr
make
make install
#不能报错!!!
#导入环境变量
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
#安装tomcat-native(tomcat8自带该包,解压即刻)
#假设tomcat在 /usr/local/tomcat
cd /usr/local/tomcat/bin
tar –xvf tomcat-native.tar.gz
#tomcat-native-1.1.32-src 版本可能不同,注意下
cd tomcat-native-1.1.32-src/jni/native
./configure --with-apr=/usr/local/apr
make
make install
#不能报错!!!
#修改tomcat的server.xml
#打开 <Executor name="tomcatThreadPool" ... 的注释
#打开 <Connector executor="tomcatThreadPool" ... 的注释 ,在该节点中修改参数 protocol="org.apache.coyote.http11.Http11AprProtocol"
#例如:<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="1000" minSpareThreads="100" maxIdleTime="60000"/>
#注释掉 <Connector port="8080" protocol="HTTP/1.1" ...
vi /usr/local/tomcat/conf/server.xml
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="1000" minSpareThreads="100" maxIdleTime="60000"/>
<Connector executor="tomcatThreadPool"
port="8080" protocol="org.apache.coyote.http11.Http11AprProtocol"
connectionTimeout="20000"
redirectPort="8443" />
#启动tomcat,catalina.out 不报错 ,有 http-apr-8080 ajp-apr-8009 即可
20-Nov-2018 16:40:17.128 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-apr-8080"]
20-Nov-2018 16:40:17.135 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-apr-8009"]
over