- 查看旧版Nginx编译参数
[root@localhost yum.repos.d]# Nginx -V
Nginx version: Nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Nginx --user=Nginx --group=Nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_modu
le --with-http_gzip_static_module
[root@localhost yum.repos.d]# ps aux | grep Nginx
root 80809 0.0 0.1 47024 1912 ? Ss 12:10 0:00 Nginx: master process Nginx
Nginx 80810 0.0 2.2 69760 22652 ? S 12:10 0:00 Nginx: worker process
Nginx 80811 0.0 2.2 69760 22652 ? S 12:10 0:00 Nginx: worker process
备份旧版本
[root@localhost yum.repos.d]# strings /usr/local/Nginx/sbin/Nginx.old
- 安装新版本的Nginx(不要执行make install)
[root@localhost ~]# tar zxf Nginx-1.15.9.tar.gz -C /usr/src/
[root@localhost Nginx-1.15.9]# ./configure --prefix=/usr/local/Nginx --user=Nginx --group=Nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module && make
#和Nginx -V 查看的所编译的要相同
[root@localhost Nginx-1.15.9]# cp objs/Nginx /usr/local/Nginx/sbin/Nginx
#使用新的二进制文件代替旧的
[root@localhost Nginx-1.15.9]# 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
#查看配置文件是否正常
[root@localhost Nginx-1.15.9]# Nginx -V
#如一切环境正常,可以看到版本号已经修改为新的了
- 发送USR2信号
[root@localhost Nginx-1.15.9]# kill -USR2 80809
#向主进程(master)发送 USR2 信号,Nginx 会启动一个新版本的master进程和对应工作进程,和旧版一起处理请求
[root@localhost Nginx-1.15.9]# ps aux | grep Nginx
[root@localhost ~]# kill -WINCH 80809
#向旧的 Nginx 主进程(master)发送 WINCH信号,它会逐步关闭自己的工作进程(主进程不退出),这时所有请求都会由新版 Nginx 处理
[root@localhost ~]# kill -QUIT 80809
#向旧的 Nginx 主进程(master)发送(QUIT、TERM、或者 KILL)信号,使旧的主进程退出
[root@localhost Nginx-1.15.9]# Nginx -v
Nginx version: Nginx/1.15.9
#测试查看版本号
over……
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。