首页 > 代码库 > nginx平滑升级

nginx平滑升级

/usr/local/nginx/sbin/nginx -V查看原先的nginx编译选项
ps aux|grep nginx > /tmp/nginx.log查看当前nginx进程并输出到文件

cd /usr/src
tar -zxvf nginx-1.6.0.tar.gz
cd nginx-1.6.0
#编译选项可能变化
举例:./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --with-pcre=../pcre-8.34/ --with-zlib=../zlib-1.2.8/ --with-http_stub_status_module --user=nginx 


make

mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
cp objs/nginx /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -t

#pid位置可能变化
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`    
kill -WINCH `cat /usr/local/nginx/logs/nginx.pid.oldbin`
kill -HUP `cat /usr/local/nginx/logs/nginx.pid.oldbin`
kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`

/usr/local/nginx/sbin/nginx -v
显示版本为新版则成功

ps aux|grep nginx
查看当前nginx进程(如果看到有旧进程存在应是正常,是逐步接管的过程)

本文出自 “linux技术博客” 博客,请务必保留此出处http://qiujiebin2010.blog.51cto.com/4701626/1604135

nginx平滑升级