下载升级的版本软件包
https://nginx.org/en/download.html
解压到新文件夹
cd /server
tar -zxvf nginx-1.26.2.tar.gz
编译
[root@hcss-ecs-df46 nginx-1.26.2]
[root@hcss-ecs-df46 nginx-1.26.2]
[root@hcss-ecs-df46 nginx-1.26.2]
备份和迁移
[root@hcss-ecs-df46 nginx-1.26.2]
[root@hcss-ecs-df46 nginx-1.26.2]
[root@hcss-ecs-df46 nginx-1.26.2]
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
给nginx发送平滑迁移信号
[root@hcss-ecs-df46 nginx-1.26.2]
查看nginx pid,会出现一个nginx.pid.oldbin
[root@hcss-ecs-df46 nginx-1.26.2]
-rw-r--r-- 1 root root 6 Dec 25 11:55 /usr/local/nginx/logs/nginx.pid
-rw-r--r-- 1 root root 6 Mar 29 2024 /usr/local/nginx/logs/nginx.pid.oldbin
关闭旧的Nginx进程
[root@hcss-ecs-df46 nginx-1.26.2]
此时不重载配置启动旧的工作进程
[root@hcss-ecs-df46 nginx-1.26.2]
结束工作进程,完成此次升级
[root@hcss-ecs-df46 nginx-1.26.2]
验证Nginx是否升级成功
[root@hcss-ecs-df46 nginx-1.26.2]
nginx version: nginx/1.26.2
built by gcc 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
configure arguments:
[root@hcss-ecs-df46 nginx-1.26.2]
root 22681 0.0 0.0 20588 1684 ? S 11:55 0:00 nginx: master process ./sbin/nginx -c ./conf/nginx.conf
nobody 22682 0.0 0.0 21000 1380 ? S 11:55 0:00 nginx: worker process
nobody 22775 0.0 0.0 21180 1552 ? S 11:56 0:00 nginx: worker process
root 22838 0.0 0.0 112816 984 pts/1 S+ 11:57 0:00 grep --color=auto nginx
参考文章
https://blog.csdn.net/weixin_60250117/article/details/138199492
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构