Nginx平滑升级

Nginx平滑升级

Posted by – 2009-09-27

#################################
# Nginx平滑升级 #
# Author: 楚霏 #
# Date: 2009-09-25#
# Env: Centos 5.3 x86_64#
#################################

#以nginx0.7.61升级到nginx0.7.62为例
#下载新版
cd /usr/local/src
wget http://sysoev.ru/nginx/nginx-0.7.62.tar.gz
tar xvf nginx-0.7.62.tar.gz
cd nginx-0.7.62
#和旧版本的编译参数一样
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/var/nginx.pid --lock-path=/usr/local/nginx/var/nginx.lock --without-select_module --without-poll_module --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_memcached_module --without-http_map_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module
make
#先不要安装拷贝文件,把旧版本重命名

mv /usr/local/nginx /usr/local/nginx.0.7.61
#可以安装了
make install
#拷回配置文件
cd /usr/local/nginx
mv conf conf.bak
mv ../nginx.0.7.61/conf ./
#检查配置
service nginx configtest
#过滤出现在正在运行的nginx进程
ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'
#再輸入以下 3 個命令 ( 數字部份請填入你自己的pid )
kill -USR2 3084
kill -WINCH 3084
kill -QUIT 3084
#检查一下,pid已经和以前的已经不同了
ps aux | grep nginx
#完成

原文地址:https://www.cnblogs.com/feihongwuhen/p/7170999.html