Nginx平滑升级

Nginx平滑升级

先安装1.0.15版本的Nginx

[root@localhost src]# yum -y install gcc gcc-c++ make libtool zlib zlib-devel pcre pcre-devel openssl openssl-devel
[root@localhost src]# tar zxf nginx-1.0.15.tar.gz 
[root@localhost src]# cd nginx-1.0.15/
[root@localhost nginx-1.0.15]# ./configure --prefix=/usr/local/nginx1.0  && make && make install
[root@localhost nginx-1.0.15]# ln -s /usr/local/nginx1.0/sbin/* /usr/local/sbin/
[root@localhost nginx-1.0.15]# nginx -t
nginx: the configuration file /usr/local/nginx1.0/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx1.0/conf/nginx.conf test is successful
[root@localhost nginx-1.0.15]# nginx

升级

[root@localhost src]# tar zxf nginx-1.14.0.tar.gz 
[root@localhost src]# cd nginx-1.14.0/
[root@localhost nginx-1.14.0]# ./configure --prefix=/usr/local/nginx1.14 --with-http_stub_status_module && make
[root@localhost ~]# mv /usr/local/nginx1.0/sbin/nginx /usr/local/nginx1.0/sbin/nginx_old
[root@localhost ~]# cp /usr/local/nginx-1.14.0/objs/nginx /usr/local/nginx1.0/sbin/
[root@localhost ~]# mv /usr/local/nginx1.0/conf/nginx.conf /usr/local/nginx1.0/conf/nginx.conf.old
[root@localhost ~]# cp /usr/local/nginx-1.14.0/conf/nginx.conf /usr/local/nginx1.0/conf/nginx.conf
[root@localhost ~]# kill -USR2 `cat /usr/local/nginx1.0/logs/nginx.pid`
[root@localhost ~]# ls /usr/local/nginx1.0/logs/
access.log  error.log  nginx.pid
[root@localhost ~]# ps aux | grep nginx
root     22194  0.0  0.0  24744   944 ?        Ss   20:38   0:00 nginx: master process nginx
nobody   22195  0.0  0.0  27224  1752 ?        S    20:38   0:00 nginx: worker process
root     25153  0.0  0.0 112648   952 pts/1    S+   20:52   0:00 grep --color=auto nginx
[root@localhost ~]# nginx -v
nginx version: nginx/1.14.0

猜你喜欢

转载自blog.csdn.net/liuxiansheng1228/article/details/80085675