CentOS yum安装或升级nginx最新版本

由于服务器定期漏洞扫描,nginx经常需要升级更新修复漏洞

先备份自己的nginx.conf和conf.d (重要) 

vim /etc/yum.repos.d/nginx.repo

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

yum info nginx 

看是否为最新版

CentOS yum安装或升级nginx最新版本_第1张图片

yum update nginx 

升级nginx

如果碰到  file /usr/lib64/nginx/modules/ngx_http_geoip_module.so from install of nginx-module-geoip-1:1.16.0-1.el7.ngx.x86_64 conflicts with file from package nginx-mod-http-geoip-1:1.12.2-3.el7.x86_64 这类模块错误。

 yum remove nginx-mod*

yum install nginx-module-*

重新安装模块解决

官网文档:http://nginx.org/en/linux_packages.html#RHEL-CentOS

 

你可能感兴趣的:(linux)