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-*