需要部署nginx的https环境,之前是yum安装的openssl,版本比较低,如下:

 
[root@nginx ~]# yum install -y pcre pcre-devel openssl openssl-devel gcc
 
[root@nginx ~]# openssl version -a
OpenSSL 1.0.1e-fips 11 Feb 2013
built on: Wed Mar 22 21:43:28 UTC 2017
platform: linux-x86_64
options:  bn(64,64) md2(int) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx)
compiler: gcc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -m64 -DL_ENDIAN -DTERMIO -Wall -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Wa,--noexecstack -DPURIFY -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
OPENSSLDIR: "/etc/pki/tls"
engines:  rdrand dynamic

默认yum安装的openssl版本是1.0.1,现在需要将版本升级到1.1.0。升级的操作记录如下:

 
[root@nginx ~]# wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz
[root@nginx ~]# tar -zvxf openssl-1.1.0g.tar.gz
[root@nginx ~]# cd openssl-1.1.0g
[root@nginx openssl-1.1.0g]# ./config shared zlib
[root@nginx openssl-1.1.0g]# make
[root@nginx openssl-1.1.0g]# make install
 
 
[root@nginx openssl-1.1.0g]# mv /usr/bin/openssl /usr/bin/openssl.bak
[root@nginx openssl-1.1.0g]# mv /usr/include/openssl /usr/include/openssl.bak
 
[root@nginx openssl-1.1.0g]#  find / -name openssl
/etc/pki/ca-trust/extracted/openssl
/data/software/nginx-1.12.2/auto/lib/openssl
/data/software/openssl-1.1.0g/apps/openssl
/data/software/openssl-1.1.0g/include/openssl
/usr/lib64/openssl
/usr/local/share/doc/openssl
/usr/local/include/openssl
/usr/local/bin/openssl
/usr/include/openssl
/usr/bin/openssl
 
[root@nginx openssl-1.1.0g]# ln -s /usr/local/bin/openssl /usr/bin/openssl
[root@nginx openssl-1.1.0g]# ln -s /usr/local/include/openssl /usr/include/openssl
 
[root@external-lb01 ~]# find / -name "libssl*"
/data/software/openssl-1.1.0g/libssl.pc
/data/software/openssl-1.1.0g/libssl.so
/data/software/openssl-1.1.0g/libssl.a
/data/software/openssl-1.1.0g/libssl.so.1.1
/data/software/openssl-1.1.0g/util/libssl.num
/usr/lib64/libssl3.so
/usr/lib64/pkgconfig/libssl.pc
/usr/lib64/libssl.so.1.0.1e
/usr/lib64/libssl.so
/usr/lib64/libssl.so.10
/usr/local/lib64/libssl.a
/usr/local/lib64/pkgconfig/libssl.pc
/usr/local/lib64/libssl.so
/usr/local/lib64/libssl.so.1.1
 
[root@nginx openssl-1.1.0g]# echo "/usr/local/lib64/" >> /etc/ld.so.conf
[root@nginx openssl-1.1.0g]# ldconfig
 
[root@nginx openssl-1.1.0g]# openssl version -a
OpenSSL 1.1.0g  2 Nov 2017
built on: reproducible build, date unspecified
platform: linux-x86_64
compiler: gcc -DZLIB -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib64/engines-1.1\""  -Wa,--noexecstack
OPENSSLDIR: "/usr/local/ssl"
ENGINESDIR: "/usr/local/lib64/engines-1.1"

=========openssl升级后编译nginx出现的问题========
如上将本机的openssl升级后,由于之前编译的nginx里没有stream模块,现在需要手动平滑添加stream模块,操作如下:

 
检查下,发现nginx没有安装stream模块
[root@external-lb01 ~]# /data/nginx/sbin/nginx -V
nginx version: nginx/1.12.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
built with OpenSSL 1.1.0g  2 Nov 2017
TLS SNI support enabled
configure arguments: --prefix=/data/nginx --user=www
--group=www --with-http_ssl_module --with-http_flv_module
--with-http_stub_status_module --with-http_gzip_static_module
--with-pcre
 
 
操作之前,一定要备份一下之前的nginx安装目录,防止操作失败进行回滚!
[root@external-lb01 ~]# cp -r /data/nginx /mnt/nginx.bak
 
之前的编译命令是:
[root@external-lb01 vhosts]# cd /data/software/nginx-1.12.2
[root@external-lb01 nginx-1.12.2]#
./configure --prefix=/data/nginx --user=www --group=www
--with-http_ssl_module --with-http_flv_module
--with-http_stub_status_module --with-http_gzip_static_module
--with-pcre
 
现在需要手动添加stream,编译命令如下:
[root@external-lb01 vhosts]# cd /data/software/nginx-1.12.2
[root@external-lb01 nginx-1.12.2]#
./configure --prefix=/data/nginx --user=www --group=www
--with-http_ssl_module --with-http_flv_module
--with-http_stub_status_module --with-http_gzip_static_module
--with-pcre --with-stream
 
报错如下:
......
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
 
原因分析:是由于openssl升级所致!
[root@external-lb01 nginx-1.12.2]# openssl version -a
OpenSSL 1.1.0g  2 Nov 2017
built on: reproducible build, date unspecified
platform: dist
compiler: cc -DNDEBUG -DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\""
OPENSSLDIR: "/usr/local/ssl"
ENGINESDIR: "/usr/local/lib/engines-1.1
 
所以编译命令需要改为:
[root@external-lb01 nginx-1.12.2]#
./configure --prefix=/data/nginx --user=www --group=www
--with-http_ssl_module --with-http_flv_module
--with-http_stub_status_module --with-http_gzip_static_module
--with-pcre --with-stream --with-openssl=/usr/local/ssl
 
然后进行make,千万注意!!!!一定不要make install!!!否则会自动覆盖掉之前的配置!!!
[root@external-lb01 nginx-1.12.2]# make
又报错如下:
.......
make[1]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 127
make[1]: Leaving directory `/usr/local/src/nginx-1.9.9'
make: *** [build] Error 2
 
解决办法:
[root@external-lb01 nginx-1.12.2]# cd auto/lib/openssl
[root@external-lb01 openssl]# cp conf /mnt/
[root@external-lb01 openssl]# vim nginx
            CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
            CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
            CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
            CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
            CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
修改为
            CORE_INCS="$CORE_INCS $OPENSSL/include"
            CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
            CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
            CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"
            CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
 
接着继续make安装
[root@external-lb01 nginx-1.12.2]# make
又报错说找不到下面两个文件
/usr/local/ssl/lib/libssl.a
/usr/local/ssl/lib/libcrypto.a
 
解决办法:
[root@external-lb01 nginx-1.12.2]# mkdir /usr/local/ssl/lib
[root@external-lb01 nginx-1.12.2]# ln -s /usr/local/lib64/libssl.a /usr/local/ssl/lib/libssl.a
[root@external-lb01 nginx-1.12.2]# ln -s /usr/local/lib64/libcrypto.a /usr/local/ssl/lib/libcrypto.a
 
然后make就可以了
[root@external-lb01 nginx-1.12.2]# make
 
最后进行平滑操作
[root@external-lb01 nginx-1.12.2]# cp -f /data/software/nginx-1.12.2/objs/nginx /data/nginx/sbin/nginx
[root@external-lb01 nginx-1.12.2]# pkill -9 nginx
[root@external-lb01 nginx-1.12.2]# /data/nginx/sbin/nginx
 
检查下,发现nginx已经安装了stream模块了
[root@external-lb01 nginx-1.12.2]# /data/nginx/sbin/nginx -V
nginx version: nginx/1.12.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
built with OpenSSL 1.1.0g  2 Nov 2017
TLS SNI support enabled
configure arguments: --prefix=/data/nginx --user=www
--group=www --with-http_ssl_module --with-http_flv_module
--with-http_stub_status_module --with-http_gzip_static_module
--with-pcre --with-stream --with-openssl=
/usr/local/ssl
 
转自
openssl版本升级操作记录 - 散尽浮华 - 博客园 http://www.cnblogs.com/kevingrace/p/8058535.html

openssl版本升级操作记录【转】的更多相关文章

  1. openssl版本升级操作记录

    需要部署nginx的https环境,之前是yum安装的openssl,版本比较低,如下: [root@nginx ~]# yum install -y pcre pcre-devel openssl ...

  2. CentOS6.9下升级默认的OpenSSH操作记录(升级到OpenSSH_7.6p1)

    近期对IDC机房服务器做了一次安全漏洞扫描,漏扫结果显示服务器的OpenSSH版本太低(CentOS6默认是OpenSSH_5.3p1),存在漏洞隐患,安全部门建议升级到OpenSSH_7.6p1.升 ...

  3. nginx缓存配置的操作记录梳理

    web缓存位于内容源Web服务器和客户端之间,当用户访问一个URL时,Web缓存服务器会去后端Web源服务器取回要输出的内容,然后,当下一个请求到来时,如果访问的是相同的URL,Web缓存服务器直接输 ...

  4. centos下升级git版本的操作记录

    在使用git pull.git push.git clone的时候,或者在使用jenkins发版的时候,可能会报类似如下的错误: error: The requested URL returned e ...

  5. linux下用户操作记录审计环境的部署记录

    通常,我们运维管理人员需要知道一台服务器上有哪些用户登录过,在服务器上执行了哪些命令,干了哪些事情,这就要求记录服务器上所用登录用户的操作信息,这对于安全维护来说很有必要.废话不多说了,下面直接记录做 ...

  6. squid代理http和https方式上网的操作记录

    需求说明:公司IDC机房有一台服务器A,只有内网环境:192.168.1.150现在需要让这台服务器能对外访问,能正常访问http和https请求(即80端口和443端口)操作思路:在IDC机房里另找 ...

  7. centos6下升级git版本的操作记录

    编译go_ethereum的时候出现了错误 然后发现是自己的git没有升级成功  因为编译需要高版本的git版本  所以会编译不成功  之后执行 root@uatjenkins01 ~]# git - ...

  8. openssl 升级 操作 -1

    好多公司都会用绿盟扫描系统漏洞,里边就会涉及到ssl 漏洞,原因是openssl 版本低导致,会让你升级到指定版本.下面就介绍一下openssl 版本升级的操作方案. 一. 查看系统版本 [root@ ...

  9. 转:centos下升级git版本的操作记录

    https://www.cnblogs.com/kevingrace/p/8252517.html 在使用git pull.git push.git clone的时候,或者在使用jenkins发版的时 ...

随机推荐

  1. HGOI 20190218 题解

    /* 又是AK局... hjc又双叒叕AK了... Hmmm...我侥幸 */ Problem A card 给出无序序列a[]可以选择一个数插入到合适的位置作为一次操作,至少多少次操作后可以把序列变 ...

  2. [luogu4268][bzoj5195][USACO18FEB]Directory Traversal

    题目大意 给你\(n\)个文件的关系,求出某一个点,这个点到叶节点的长度的总距离最短.(相对长度的定义在题目上有说明) 感想 吐槽一下出题人,为什么出的题目怎么难看懂,我看了整整半个小时,才看懂. 题 ...

  3. 配置AD RMS及SharePoint 2013 IRM问题解决及相关资源

    最近配置AD RMS及SharePoint 2013 IRM遇到几个问题: 1. RMS配置好后,client端连不上, 一直要求输入用户名和密码. 后来换了台不是SP的机器,并用内部DB,搞定.   ...

  4. BZOJ3235 [Ahoi2013]好方的蛇 【单调栈 + dp】

    题目链接 BZOJ3235 题解 求出每个点为顶点,分别求出左上,左下,右上,右下的矩形的个数\(g[i][j]\) 并预处理出\(f[i][j]\)表示点\((i,j)\)到四个角的矩形内合法矩形个 ...

  5. TextView 借助Linkify,使用自定义模式设置链接

    http://my.oschina.net/fengheju/blog/176105 TextView是android中的一个比较常用的控件,它有一个非常有趣的特性,可以通过android:autoL ...

  6. Activity的跳转与传值

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://android.blog.51cto.com/268543/323982 Acti ...

  7. A1038. Recover the Smallest Number

    Given a collection of number segments, you are supposed to recover the smallest number from them. Fo ...

  8. 【POJ2248】加法链 idfs

    首先,在这道题的搜索框架中,在对每一位进行枚举时,复杂度为\(O(n^2)\),但是可知最优解序列的长度不会太长. 其次,采用 \(bool\) 类型返回值时,是一种存在性搜索,并不一定能够得到最优解 ...

  9. django---APIView源码分析

    django---APIView源码分析 前言:APIView基于View 看这部分内容一定要懂django-CBV里的内容 在django-CBV源码分析中,我们是分析的from django.vi ...

  10. MATLAB:增加噪声,同时多次叠加噪声图和原图以及求平均图像(imnoise,imadd函数)

    本次涉及了对原图像增加高斯噪声.多次叠加原图和高斯噪声图以及叠加后的平均图像. close all; %关闭当前所有图形窗口,清空工作空间变量,清除工作空间所有变量 clear all; clc; R ...