因为安装TLS 1.3协议是要OpenSSL1.1.1以上的,所以先升级OpenSSL1.1.1.
先去官网下载这个这个OpenSSL1.1.1版本的tar安装包
添加链接描述
先查询系统的版本是多少
才1.02 然后上传下载好的tar安装包
一般先解压啦
tar -zxvf openssl-1.1.1q.tar.gz
然后进入解压的目录执行以下语句:
./config --prefix=/usr/local/openssl
安装过程中,遇到问题:Operating system: x86_64-whatever-linux2 You need Perl 5.
先安装Perl 5,
添加链接描述
这有安装的版本和安装教程 官网的 添加链接描述
wget https://www.cpan.org/src/5.0/perl-5.30.3.tar.gz
tar -xzf perl-5.30.3.tar.gz
cd perl-5.30.3
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install
make和make test 都出现一大堆内容,我就不截图了。
make test 成功的截图
这是make install的成功截图
继续执行安装openssl的命令
执行配置:
./config --prefix=/usr/local/openssl
make && make install
执行后的结果的截图:
mv /usr/bin/openssl \
/usr/bin/openssl.OFF
mv /usr/include/openssl \
/usr/include/openssl.OFF
ln -s \
/usr/local/openssl/bin/openssl \
/usr/bin/openssl
ln -s \
/usr/local/openssl/include/openssl \
/usr/include/openssl
echo "/usr/local/openssl/lib"\
>>/etc/ld.so.conf
ldconfig -v
成功的截图:
要重新编译Nginx
升级OpenSSL之后,nginx需要重新编译,否则TLS还是旧版本的
下面是基本安装,如您需求更多,请自行调整
用到的软件
openssl
前面已经安装完了
pcre
注意:nginx 使用的版本为 PCRE,不支持 PCRE2,所以要选择 8.* 的版本。
下载pcre
添加链接描述
例如下载到 /usr/local
cd /opensslUp1.1.1/
tar -zxv -f pcre-8.43.tar.gz
cd pcre-8.43
./configure --prefix=/usr/local/pcre/
make && make install
执行 ./configure --prefix=/usr/local/pcre/ 这个命令的截图
执行make && make install的截图:
zlib
下载新的zlib的库:
添加链接描述
例如下载到 /opensslUp1.1.1/
cd /opensslUp1.1.1/
tar -zxv -f zlib-1.2.12.tar.gz
cd zlib-1.2.12
./configure --prefix=/usr/local/zlib/
make && make install
执行的截图:
可以通过查询nginx的版本来查询当初编译的脚本
进入到你原本安装的nginx的目录:
cd sbin
执行./nginx -V 查询版本信息和编译信息
这是我重新配置的编译脚本
[root@TestNginx source]# ./configure --user=root --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-stream --with-stream_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-openssl=/opensslUp1.1.1/openssl-1.1.1q --with-pcre=/opensslUp1.1.1/pcre-8.43 --with-zlib=/opensslUp1.1.1/zlib-1.2.12
然后执行make && make install
make && make install
然后执行 启动
./nginx -c /usr/local/nginx/conf/nginx.conf
./nginx -s reload