nginx平滑升级

[root@kvm1 nginx-1.12.2]# nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (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_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre --with-file-aio --with-http_secure_link_module
[root@kvm1 ~]# wget http://nginx.org/download/nginx-1.14.0.tar.gz -P /usr/local/src
[root@kvm1 ~]# cd /usr/local/src
[root@kvm1 src]# tar -xf nginx-1.14.0.tar.gz
[root@kvm1 src]# ls
nginx-1.12.2  nginx-1.12.2.tar.gz  nginx-1.14.0  nginx-1.14.0.tar.gz  php-5.6.38
[root@kvm1 src]# cd nginx-1.14.0/
#用之前编译的参数进行编译,nginx -V 查看到的
[root@kvm1 nginx-1.14.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre --with-file-aio --with-http_secure_link_module
[root@kvm1 nginx-1.14.0]# make
#不要make install
[root@kvm1 nginx-1.14.0]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
[root@kvm1 nginx-1.14.0]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  Makefile  man  objs  README  src
[root@kvm1 nginx-1.14.0]# cp objs/nginx /usr/local/nginx/sbin/
#测试一下新复制过来的文件是否生效
[root@kvm1 nginx-1.14.0]# /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
#让nginx把nginx.pid文件修改成nginx.pid.oldbin,随即启动nginx,实现不间断服务运行
[root@kvm1 nginx-1.14.0]kill -USR2 `cat /usr/local/nginx/nginx.pid`  
#更新配置文件
[root@kvm1 nginx-1.14.0kill  -WINCH(平缓停止worker process) `cat /usr/local/nginx/nginx.pid.oldbin
[root@kvm1 nginx-1.14.0]kill -QUIT `cat /usr/local/nginx/nginx.pid.oldbin`
 #平缓停止
[root@kvm1 nginx-1.14.0]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.14.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (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_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre --with-file-aio --with-http_secure_link_module



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值