Nginx与OpenSSL平滑升级,办理部门网站Firefox可以正常访问,但Chrome访问 ...

打印 上一主题 下一主题

主题 884|帖子 884|积分 2652

一、安装包的下载
(1)Nginx的下载(这里下载最新的稳固版本1.26.1):下载地点nginx: download
https://nginx.org/en/download.html
(2)Pcre的下载(这里选择稳固版本8.41): PCRE download | SourceForge.netDownload PCRE for free. PERL 5 regular expression pattern matching. The Perl Compatible Regular Expressions (PCRE) library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE has its own native API, in addition to a set of POSIX compatible wrapper functions.
https://sourceforge.net/projects/pcre/,这个是nginx编译安装的依赖包
(3)OpenSSL的下载(这里选择下载最新稳固版本3.3.1):[ Downloads ] - /source/index.html
https://www.openssl.org/source/,主要办理谷歌新版浏览器访问提示“ERR SSL PROTOCOL ERROR”的问题
二、OpenSSL的安装
(1)查看OpenSSL的版本

(2)查看OpenSSL的路径

(3)备份OpenSSL文件
  1. sudo mv /usr/bin/openssl /usr/bin/openssl_old
  2. sudo mv /usr/include/openssl /usr/include/openssl_old
复制代码
(4)解压OpenSSL并设置安装目录
  1. tar –zxvf openssl-3.3.1.tar.gz
复制代码
(5)切换到解压好的openssl目录
  1. cd openssl-3.3.1/
复制代码
(6)设置openssl安装目录
  1. ./config --prefix=/usr/local/openssl
复制代码

(7)编译与安装
  1. sudo make && sudo make install
复制代码
等候完成即可
(8)创建软链接
说明:创建的软链接和之前没升级通过whereis openssl保持一致即可。
  1. ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
  2. ln -s /usr/local/openssl/include/openssl /usr/include/openssl
复制代码
(9)添加动态链接库数据(注意须要切到root用户才有权限)
  1. echo "/usr/local/openssl/lib64/" >> /etc/ld.so.conf
复制代码
检查一下,已经在/etc/ld.so.conf中存在:
  1. include ld.so.conf.d/*.conf
  2. /usr/local/openssl/lib64/
复制代码
(10)更新动态链接库:
  1. sudo ldconfig -v
复制代码
(11)验证openssl
查看openssl版本 openssl version -a会表现全面具体信息
  1. OpenSSL 3.3.1 4 Jun 2024 (Library: OpenSSL 3.3.1 4 Jun 2024)
  2. built on: Thu Jun 13 02:55:45 2024 UTC
  3. platform: linux-x86_64
  4. options:  bn(64,64)
  5. compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
  6. OPENSSLDIR: "/usr/local/openssl/ssl"
  7. ENGINESDIR: "/usr/local/openssl/lib64/engines-3"
  8. MODULESDIR: "/usr/local/openssl/lib64/ossl-modules"
  9. Seeding source: os-specific
  10. CPUINFO: OPENSSL_ia32cap=0xfefa320b5f8bffff:0x800d19e4fbb
复制代码
(12)到此openssl升级完成
三、Nginx新版本的安装
(1)将下载的好Nginx-1.26.1解压并进入Nginx-1.26.1目录
  1. tar -zxvf Ninx-1.26.1.gz
  2. cd /opt/Nginx-1.26.1/
复制代码
(2)查看旧版本Nginx设置的编译文件并复制configure arguments,将openssl对应的版本替换一下

  1. nginx version: nginx/1.11.3
  2. built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
  3. built with OpenSSL 1.0.1 14 Mar 2012
  4. TLS SNI support enabled
  5. configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=../pcre-8.41 --with-openssl=../openssl-1.0.1
复制代码
(3)设置Nginx新版本的编译参数
  1. [root@web03 nginx-1.24.0]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=../pcre-8.41 --with-openssl=../openssl-3.3.1
复制代码
(4)实行make,不要make install
  1. [root@web03 nginx-1.24.0]# sudo make
复制代码
(5)将nginx-1.26.0目录下的nginx放到/usr/local/nginx/sbin/目录下
  1. [root@web03 sbin]# mv /opt/nginx-1.26.0/objs/nginx /usr/local/nginx/sbin/
  2. [root@web03 sbin]# ls
  3. nginx
  4. [root@web03 sbin]#
复制代码
(6)天生新的nginx  master历程
  1. [root@web03 ~]# cd /usr/local/nginx/logs/
  2. [root@web03 logs]# cat nginx.pid
  3. 15210
  4. [root@web03 logs]# kill -USR2 15210
  5. [root@web03 logs]# ls
  6. access.log  error.log  nginx.pid  nginx.pid.oldbin
  7. [root@web03 logs]#
复制代码
可以看到,当前的nginx历程文件自动命名为nginx.pid.oldbin,又天生了一个新的nginx.pid文件
(7)天生新的nginx  master历程
  1. [root@web03 logs]# cat nginx.pid.oldbin
  2. 15210
  3. [root@web03 logs]# kill -WINCH 15210
  4. [root@web03 logs]# kill -QUIT 15210
  5. [root@web03 logs]# ls
  6. access.log  error.log  nginx.pid
  7. [root@web03 logs]#
复制代码
旧版本的nginx历程已经被新版本的nginx历程替代
(8)可以看到当前版本已经升级到了1.26.1
  1. [root@web03 logs]# /usr/local/nginx/sbin/nginx -V
  2. nginx version: nginx/1.26.1
  3. built by gcc 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  4. built with OpenSSL 3.3.1 4 Jun 2024
  5. TLS SNI support enabled
  6. configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=../pcre-8.41 --with-openssl=../openssl-3.3.1
复制代码
(9)访问页面测试:输入网站即可

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

老婆出轨

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表