1.安装编译用的工具包
# yum install -y gcc gcc-c++ autoconf libtool make zlib zlib-devel
2.安装Openssl_1.1.1s
当前Openssl官网(/source/index.html)最新的有三个主版本,也就是1.1.1、3.0、3.1三个版本,基于CentOS还是7.9,选择1.1.1的最新版本,也就是1.1.1s版。
# tar zxvf openssl-1.1.1s.tar.gz
# cd openssl-1.1.1s
# ./config // 为了替代系统自带的openssl,就不指定安装目录
# make
# make install
# cd ..
# openssl version
报错
# echo "/usr/local/lib64" >> /etc/ld.so.conf //不指定目录时,openssl的so文件会在这个路径下,要把这个目录加载到ldconfig的配置中
# ldconfig -v //执行后,配置才会生效
# openssl version -a
OpenSSL 1.1.1s 1 Nov 2022
built on: Fri Feb 3 01:27:51 2023 UTC
platform: linux-x86_64
options: bn(64,64) rc4(16x,int) des(int) idea(int) blowfish(ptr)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG
OPENSSLDIR: "/usr/local/ssl"
ENGINESDIR: "/usr/local/lib64/engines-1.1"
Seeding source: os-specific
3.安装Pcre_8.42
# tar zxvf pcre-8.42.tar.gz
# cd pcre-8.42
# ./configure
# make
# make install
# cd ..
# echo "/usr/local/lib" >> /etc/ld.so.conf // 不指定目录,pcre的so问价默认会在这个目录下
# ldconfig -v
4.安装Nginx_1.20.2
# tar zxvf nginx-1.20.2.tar.gz
# cd nginx-1.20.2
# ./configure --prefix=/usr/local/nginx-1.20.2 --with-http_ssl_module --with-pcre
# make
# make install
# cd ..
# /usr/local/nginx-1.0.2/sbin/nginx -V //验证安装信息
nginx version: nginx/1.20.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.1.1s 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx-1.20.2 --with-http_ssl_module --with-pcre