标签:配置 pat 编辑 gcc-c++ 并发处理 rc.local 环境变量 conf life
tomcat中一共有三种运行模式,分别是:bio,nio,apr安装apr-util
yum install expat-devel #安装依赖包
wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar xf apr-util-1.6.1.tar.gz -C /usr/local/src/
cd /usr/local/src/apr-util-1.6.1
./configure --with-apr=/usr/local/apr
make && make install
安装native
cd /usr/local
wget http://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.2.16/source/tomcat-native-1.2.16-src.tar.gz
tar xf tomcat-native-1.2.16-src.tar.gz -C /usr/local/src/
cd /usr/local/src/tomcat-native-1.2.16-src/native
./configure --with-apr=/usr/local/apr --with-java-home=/usr/local/jdk
如果提示openssl不兼容,(error: Your version of OpenSSL is not compatible with this version of tcnativ)需要重新安装高版本的openssl
wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar xf openssl-1.0.2-latest.tar.gz
cd openssl-1.0.2q
./config --prefix=/usr/local/openssl -fPIC #注意这里需要加入 -fPIC参数,否则后面在安装tomcat native 组件会出错
make && make install
mv /usr/bin/openssl ~
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
openssl version #查看安装后的版本
OpenSSL 1.0.2q 20 Nov 2018
cd /usr/local/src/tomcat-native-1.2.16-src/native #进入native目录,再次编译安装native
./configure --with-apr=/usr/local/apr --with-java-home=/usr/local/jdk --with-ssl=/usr/local/openssl
make && make install
安装完成后提示:"have your system administrator add LIBDIR to ‘/etc/ld.so.conf‘"
需要添加库文件:
vim /etc/ld.so.conf
/usr/local/apr/lib ##添加此行
[root@localhost native]# ldconfig
[root@localhost native]# echo "ldconfig" >>/etc/rc.local
添加环境变量:
[root@localhost native]# vim /etc/profile
最后添加:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
export LD_RUN_PATH=$LD_RUN_PATH:/usr/local/apr/lib
重读生效:
[root@localhost native]#source /etc/profile
编辑tomcat配置文件
vim server.xml
protocol="org.apache.coyote.http11.Http11AprProtocol" #修改HTTP/1.1协议内容
重启tomcat,就会看到协议已经换成apr
lifecycleEvent Loaded APR based Apache Tomcat Native library 1.2.16 using APR version 1.6.5.
如果是CentOS7,apr、openssl直接yum安装即可使用,省去很多编译安装的繁琐步骤
标签:配置 pat 编辑 gcc-c++ 并发处理 rc.local 环境变量 conf life
原文地址:http://blog.51cto.com/kouhao/2336218