平滑升级nginx遇到的问题

时间:2022-04-17 04:40:05

今天正式环境网站宕机,根据nginx的错误日志是因为nginx本身版本太低的问题,是nginx自身的bug

error.log报的错误信息如下:

2017/11/02 16:59:49 [crit] 68660#0: *34431 SSL_shutdown() failed (SSL: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init) while closing request, client: 10.2.21.75, server: 0.0.0.0:443
2017/11/02 16:59:54 [crit] 68661#0: *36315 SSL_shutdown() failed (SSL: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init) while closing request, client: 222.221.169.145, server: 0.0.0.0:443
2017/11/02 16:59:54 [crit] 68661#0: *36316 SSL_shutdown() failed (SSL: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init) while closing request, client: 222.221.169.145, server: 0.0.0.0:443
2017/11/02 16:59:54 [crit] 68661#0: *36314 SSL_shutdown() failed (SSL: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init) while closing request, client: 222.221.169.145, server: 0.0.0.0:443
2017/11/02 16:59:55 [crit] 68661#0: *36388 SSL_shutdown() failed (SSL: error:140E0197:SSL routines:SSL_shutdown:shutdown while in init) while closing request, client: 222.172.244.195, server: 0.0.0.0:443

据网上搜索,可以确定应该是nginx的问题,于是决定升级nginx,解压后执行./configure时报错如下:

 ./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the
module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using
--with-pcre=<path> option.

于是安装pcre-devel解决问题
yum -y install pcre-devel  但是提示

平滑升级nginx遇到的问题

 在网上搜的类似yum命令均提示已安装并且是最新版本 ,但是安装新版本nginx依旧提示缺少pcre

于是自己下载pcre-8.37.tar.gz 、安装、成功 , 再执行安装nginx、成功了..........

经过仔细研究终于发现问题所在,原来pcre和pcre-devel是两个包,安装失败并非是yum命令的原因,相反安装的时候能用yum尽量用yum安装

所以正确的yum命令应该是 yum install pcre pcre-devel  要安装这两个包

 

其过程中值得注意的点:1、执行make && make install 时不要少打&(这里很坑!总忘!唉!)