nginx平滑升级
1.查询原来安装配置信息
[root@t-scrmap1-v-szzb local]# netstat -unlatp | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2410/nginx tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2410/nginx [root@t-scrmap1-v-szzb local]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.8.1 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module [root@t-scrmap1-v-szzb local]#
2.编译新版本
1 tar -xvf nginx-1.10.2.tar.gz 2 cd nginx-1.10.2 3 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module 4 make
3.升级
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx-low #备份原版本 cp objs/nginx /usr/local/nginx/sbin/ #cp新的启动程序到sbin目录 [root@t-scrmap1-v-szzb nginx-1.10.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@t-scrmap1-v-szzb nginx-1.10.2]#
4.升级成功
[root@t-scrmap1-v-szzb nginx]# ./sbin/nginx -V nginx version: nginx/1.10.2 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module [root@t-scrmap1-v-szzb nginx]# netstat -unlatp | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 18308/nginx tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 18308/nginx [root@t-scrmap1-v-szzb nginx]#
公众号请关注:侠之大者