/opt/apr目录下有:

apr-1.7.0.tar.gz

apr-iconv-1.2.2.tar.gz

apr-util-1.6.1.tar.gz

tomcat-native-1.2.23-src.tar.gz


安装apr-1.7.0.gz

解压: 

tar -xzvf  apr-1.7.0.tar.gz


进入解压目录:

cd  /opt/apr/apr-1.7.0

./configure --prefix=/opt/apr/apr


报错:

config.status: executing libtool commands

rm: cannot remove 'libtoolT': No such file or directory

config.status: executing default commands


解决

进入解压目录:

cd /opt/apr/apr-1.7.0/

修改文件内容:

vim configure

RM='$RM'修改为 RM='$RM -f'

保存退出


重新执行

./configure --prefix=/opt/apr/apr

make  && make install



安装apr-iconv-1.2.2.tar.gz

解压:

tar -zxvf apr-util-1.6.1.tar.gz 


进入解压目录:

cd apr-util-1.6.1

./configure --prefix=/opt/apr/apr/apr-util --with-apr=/opt/apr/apr

make  && make install


报错:

xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

 #include <expat.h>

                   ^

compilation terminated.

make[1]: *** [xml/apr_xml.lo] Error 1

make[1]: Leaving directory `/opt/apr/apr-util-1.6.1'

make: *** [all-recursive] Error 1


解决

yum install expat-devel -y


重新执行:

make  && make install




安装apr-iconv-1.2.2.tar.gz

解压:

tar -zxvf apr-iconv-1.2.2.tar.gz


进入解压目录:

cd apr-iconv-1.2.2

./configure --prefix=/opt/apr/apr/apr-iconv --with-apr=/opt/apr/apr

make  && make install



安装tomcat-native-1.2.23-src.tar.gz

解压:

tar -zxvf tomcat-native-1.2.23-src.tar.gz


进入解压目录:

cd tomcat-native-1.2.23-src/native

./configure --prefix=/opt/apr/apr --with-apr=/opt/apr/apr --with-apr=/opt/apr/apr --with-java-home=/usr/local/jdk1.8.0_201

make  && make install

chmod -R 755 /opt/apr/


方法1:

参考:

https://www.cnblogs.com/hyzhou/p/7077012.html 


更改配置文件

vim /etc/profile


末尾添加:

#apr
export LD_LIBRARY_PATH=/opt/apr/apr/lib


保存,生效:

source /etc/profile


修改server.xml

cd /usr/local/apache-tomcat-7.0.53/conf

vim server.xml

<Connector port="8090" protocol="HTTP/1.1”中的protocol修改成org.apache.coyote.http11.Http11AprProtocol


重启Tomcat


查看tomcat启动情况

cd /usr/local/apache-tomcat-7.0.53/logs

tail -100f   catalina.out

INFO: Deploying web application directory /usr/local/apache-tomcat-7.0.53/webapps/manager

Aug 20, 2019 4:53:41 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["http-bio-8090"]

Aug 20, 2019 4:53:41 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["ajp-apr-8009"]

Aug 20, 2019 4:53:41 PM org.apache.catalina.startup.Catalina start

INFO: Server startup in 45064 ms


与参考博主的结果不一样


于是,我把所有的配置都还原,结果

INFO: Deploying web application directory /usr/local/apache-tomcat-7.0.53/webapps/manager

Aug 20, 2019 5:16:18 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["http-apr-8090"]

Aug 20, 2019 5:16:18 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["ajp-apr-8009"]

Aug 20, 2019 5:16:18 PM org.apache.catalina.startup.Catalina start

INFO: Server startup in 36873 ms


居然和参考博主的结果一样

这TM是在逗我么

--------------------

方法2:

参考:

https://www.cnblogs.com/radio/p/9389505.html 


cd /usr/local/apache-tomcat-7.0.53/bin

vim catalina.sh


################

#add my verfy

JAVA_OPTS="$JAVA_OPTS -Djava.library.path=/opt/apr/apr/lib"

################


vim /usr/local/apache-tomcat-7.0.53/conf/server.xml


<!--打开配置  -->

    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"

        maxThreads="150" minSpareThreads="4"/>


<!-- 添加配置 -->

    <Connector executor="tomcatThreadPool"

               maxThreads="1000"

               URIEncoding="UTF-8"

               port="8080"

               protocol="org.apache.coyote.http11.Http11AprProtocol"

               connectionTimeout="20000"

               enableLookups="false"

               redirectPort="8443" />



cd /usr/local/apache-tomcat-7.0.53/logs

tail -100f   catalina.out

INFO: Deploying web application directory /usr/local/apache-tomcat-7.0.53/webapps/manager

Aug 20, 2019 5:35:41 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["http-apr-8090"]

Aug 20, 2019 5:35:41 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["http-apr-8080"]

Aug 20, 2019 5:35:41 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["ajp-apr-8009"]

Aug 20, 2019 5:35:41 PM org.apache.catalina.startup.Catalina start

INFO: Server startup in 32833 ms


但8080端口网页是打不开的

CentOS 7  Tomcat APR安装:本人已安装好了Tomcat_Linux  Tomcat APR


于是,我将server.xml中,Connector executor 8080端口改为8090

<!-- 添加配置 -->

    <Connector executor="tomcatThreadPool"

               maxThreads="1000"

               URIEncoding="UTF-8"

               port="8090"

               protocol="org.apache.coyote.http11.Http11AprProtocol"

               connectionTimeout="20000"

               enableLookups="false"

               redirectPort="8443" />



结果

INFO: Deploying web application directory /usr/local/apache-tomcat-7.0.53/webapps/manager

Aug 20, 2019 5:43:59 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["http-apr-8090"]

Aug 20, 2019 5:43:59 PM org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["ajp-apr-8009"]

Aug 20, 2019 5:43:59 PM org.apache.catalina.startup.Catalina start

INFO: Server startup in 33614 ms


算是成功吧


但我不明白我不进行配置为啥也是apr模式。。。。留着,等以后有机缘懂了再记录。