Nginx升級

ahuo發表於2018-10-30

Ubuntu14.04預設的安裝源中安裝的是Nginx 1.4.6


echo deb http://nginx.org/packages/ubuntu/ trusty nginx >> /etc/apt/sources.list.d/nginx.list
echo deb-src http://nginx.org/packages/ubuntu/ trusty nginx >> /etc/apt/sources.list.d/nginx.list

wget http://nginx.org/keys/nginx_signing.key && apt-key add nginx_signing.key

apt-get update

apt-cache policy nginx 檢視版本

 

apt-get install -y nginx=1.14.0-1~trusty

 

 

centos 7 版本升級nginx

 

 

1、首先下載對應最新版nginx
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

 

2、然後就是建立yum倉庫
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm


3、解除安裝系統原有的舊版的nginx
yum remove nginx
4、下載安裝nginx
yum install nginx

  • 升級也可以

(yum update nginx -y)

 


5、啟動nginx
systemctl start nginx

 

 

錯誤

nginx: [emerg] module "/usr/lib64/nginx/modules/ngx_http_geoip_module.so" version 1012002 instead of 1014000 in /usr/share/nginx/modules/mod-http-geoip.conf:1

解決方法

yum remove nginx-mod*
yum install nginx-module-*

相關文章