nginx yum升级

原贴:https://www.cnblogs.com/cherishthepresent/p/17668713.html

 

1、首先查看通过yum安装的Nginx的版本,如图:

nginx version: nginx/1.20.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.1.1g FIPS  21 Apr 2020 (running with OpenSSL 1.1.1n  15 Mar 2022)
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-pat

从上图可以看出,当前版本比较旧,现在我们需要升级到较新的版本,yum安装的nginx建议还是通过yum方式升级,否则可能出问题(当然,出了问题也可以重新装,不过麻烦而已)

2、添加新的Nginx源,并安装,如下:

wget https://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

3、清除当前的yum缓存后,升级Nginx,命令如下:

yum clean all && yum makecache
yum update nginx               #升级nginx

4、再次检查Nginx版本,已经升级到最新版本,如图:

 nginx -V
nginx version: nginx/1.26.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx -

posted @ 2024-10-22 10:38  liulj0713  阅读(110)  评论(0编辑  收藏  举报