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.编译新版本

 tar -xvf nginx-1.10..tar.gz
cd nginx-1.10.
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module
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
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.]#

4.升级成功

[root@t-scrmap1-v-szzb nginx]# ./sbin/nginx -V
nginx version: nginx/1.10.2
built by gcc 4.4. (Red Hat 4.4.-) (GCC)
built with OpenSSL 1.0.1e-fips Feb
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.0.0:* LISTEN /nginx
tcp 0.0.0.0: 0.0.0.0:* LISTEN /nginx
[root@t-scrmap1-v-szzb nginx]#
上一篇:【Linux】系统版本信息


下一篇:linux+php+apache web调用python脚本权限问题