Nginx 平滑升级
2022/8/25 5:24:27
本文主要是介绍Nginx 平滑升级,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1.下载想要升级的nginx包
wget http://nginx.org/download/nginx-1.21.6.tar.gz
2.解压nginx压缩包
tar -zxvf nginx-1.21.6.tar.gz
3.进入nginx-1.21.6文件夹下
cd nginx-1.21.6
4.查看原版本nginx 的配置
/usr/local/nginx/sbin/nginx -V
[root@localhost nginx-1.21.6]# /usr/local/nginx/sbin/nginx -V
#nginx的版本
nginx version: nginx/1.20.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
#nginx的配置信息
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre
5.配置新版nginx
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre
6.编译
make
7.移走原先的nginx二进制文件
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx_old
8.替换新编译的文件到原nginx的sbin目录下
cp objs/nginx /usr/local/nginx/sbin/
9.执行升级命令(在解压出的新版本的nginx源文件目录下执行)
make upgrade
[root@localhost nginx-1.21.6]# 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
10.查看是否升级成功
/usr/local/nginx/sbin/nginx -V
由原来的1.20.2已经升级到1.21.6
nginx version: nginx/1.21.6
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre
这篇关于Nginx 平滑升级的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-29Nginx发布学习:从入门到实践的简单教程
- 2024-10-28Nginx发布:新手入门教程
- 2024-10-21nginx 怎么设置文件上传最大20M限制-icode9专业技术文章分享
- 2024-10-17关闭 nginx的命令是什么?-icode9专业技术文章分享
- 2024-09-17Nginx实用篇:实现负载均衡、限流与动静分离
- 2024-08-21宝塔nginx新增8022端口方法步骤-icode9专业技术文章分享
- 2024-08-21nginx配置,让ws升级为wss访问的方法步骤-icode9专业技术文章分享
- 2024-08-15nginx ws代理配置方法步骤-icode9专业技术文章分享
- 2024-08-14nginx 让访问带有/relid的地址返回404 ,例子 /relid-x-0.36-y-131.html-icode9专业技术文章分享
- 2024-08-14nginx 判断地址有/statics/的路径,指向到/home/html/statics/目录-icode9专业技术文章分享