标签:nginx
首先查看nginx当前版本
通过nginx -V 命令就可以查看当前的版本,已经当前版本安装时候的一些nginx命令
[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.12.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
configure arguments: --prefix=/usr/local/nginx
1.下载新版本的nginx-1.13.3.tar.gz, 解压后,进入该目录
使用上文同样的configure进行配置
cd /usr/local/src/
tar -zxvf nginx-1.13.3.tar.gz
cd nginx-1.13.3
#./configure --prefix=/usr/local/nginxl
#make
2.备份之前旧的nginx文件,这里只需要备份nginx 这个文件即可
[root@localhost sbin]# mv ./nginx ./nginx.old
3.复制新的nginx到nginx的目录,只需要替换sbin 目录下的nginx文件
cd /usr/local/src/nginx-1.13.3/objs
[root@localhost objs]# cp nginx /usr/local/nginx/sbin
4.执行升级
直接调用nginx命令 make upgrade 进行升级,升级的具体代码如下:
[root@localhost nginx-1.13.3]# make upgrade
/usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
sleep 1
test -f /usr/local/nginx/logs/nginx.pid.oldbin
kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`
5,如无错误提示,则升级完成
再次通过 /nginx -V 命令查看当前的版本
[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.13.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
configure arguments: --prefix=/usr/local/nginx
本文出自 “腿毛的忧伤” 博客,谢绝转载!
标签:nginx
原文地址:http://12778799.blog.51cto.com/12768799/1948141