21 Nginx使用make命令升级

21 Nginx使用make命令升级

21.1 备份

第一步:将 nginx-1.16.1 版本 sbin 目录下的 nginx 进行备份

[root@nginx-120 /usr/local/nginx/sbin]# ./nginx -v
nginx version: nginx/1.16.1
[root@nginx-120 /usr/local/nginx/sbin]# mv nginx nginx_1.16.1
[root@nginx-120 /usr/local/nginx/sbin]# ls -ltr
total 7396
-rwxr-xr-x 1 root root 3746800 Mar 23 11:43 nginx_1.14.2
-rwxr-xr-x 1 root root 3825552 Mar 23 12:13 nginx_1.16.1

21.2 复制

第二步:将 nginx-1.14.2 安装目录编译后的 objs 目录下的 nginx 文件,拷贝到原来 /usr/local/nginx/sbin 目录下

[root@nginx-120 /usr/local/nginx/sbin]# cp /root/nginx-1.14.2/objs/nginx ./
[root@nginx-120 /usr/local/nginx/sbin]# ls -ltr
total 11056
-rwxr-xr-x 1 root root 3746800 Mar 23 11:43 nginx_1.14.2
-rwxr-xr-x 1 root root 3825552 Mar 23 12:13 nginx_1.16.1
-rwxr-xr-x 1 root root 3746800 Mar 23 19:29 nginx

21.3 make upgrade

第三步:进入到安装目录,执行 make upgrade

[root@nginx~120 /usr/local/nginx/sbin]# cd /root/nginx-1.14.2/
[root@nginx-120 ~/nginx-1.14.2]# 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` [root@nginx-120 ~/nginx-1.14.2]# ps -ef|grep nginx root 16205 1 0 19:31 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx nobody 16207 16205 0 19:31 ? 00:00:00 nginx: worker process root 16213 1453 0 19:31 pts/0 00:00:00 grep --color=auto nginx

21.4 检查

第四步:查看是否更新成功

[root@nginx-120 ~/nginx-1.14.2]# cd /usr/local/nginx/sbin/
[root@nginx-120 /usr/local/nginx/sbin]# ./nginx -v
nginx version: nginx/1.14.2

21.5 访问

浏览器访问:http://10.0.0.120/

image

 

———————————————————————————————————————————————————————————————————————————

                                                                                                                         无敌小马爱学习

posted on 2026-03-23 12:17  马俊南  阅读(1)  评论(0)    收藏  举报