已安装版本

[root@ceshi100 nginx]# /opt/nginx/sbin/nginx -v

nginx version: nginx/1.14.0

升级版本

[root@ceshi100 nginx]# wget http://nginx.org/download/nginx-1.15.0.tar.gz

[root@ceshi100 nginx]# tar xf nginx-1.15.0.tar.gz 

[root@ceshi100 nginx]# cd nginx-1.15.0

[root@ceshi100 nginx-1.15.0]# /opt/nginx/sbin/nginx -V

nginx version: nginx/1.14.0

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 

built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

configure arguments: --prefix=/opt/nginx --user=www --group=www --without-http_memcached_module --without-http_map_module --without-http_geo_module --with-http_stub_status_module --with-http_ssl_module --with-stream

[root@ceshi100 nginx-1.15.0]# ./configure --prefix=/opt/nginx --user=www --group=www --without-http_memcached_module --without-http_map_module --without-http_geo_module --with-http_stub_status_module --with-http_ssl_module --with-stream

[root@ceshi100 nginx-1.15.0]# make

[root@ceshi100 nginx-1.15.0]# cp /opt/nginx/sbin/nginx{,.old}

[root@ceshi100 nginx-1.15.0]# cd objs/

[root@ceshi100 objs]# cp -rfp nginx /opt/nginx/sbin/nginx

cp: overwrite `/opt/nginx/sbin/nginx'? y

然后执行下面操作:

kill -USR2 `cat /var/run/nginx.pid`              

        将旧版本Nginx的主进程将重命名为nginx.pid.oldbin,并执行新版本的Nginx可执行程序,启动新的主进程和新的工作进程,再次生成新的nginx.pid文件

kill -WINCH `cat /var/run/nginx.pid.oldbin`      

平缓停止worker process(此步骤可省略)

kill -QUIT `cat /var/run/nginx.pid.oldbin`       

平缓停止旧的Nginx服务进程

[root@ceshi100 objs]# /opt/nginx/sbin/nginx -v

nginx version: nginx/1.15.0


Nginx支持的信号

QUIT          平滑关闭

HUP           平滑重启,重新加载配置文件

USR1          重新打开日志文件

USR2          平滑升级可执行程序

WINCH         平滑关闭工作进程



添加新模块--with-http_realip_module

[root@baiduyun nginx]# tar xf nginx-1.15.2.tar.gz 

[root@baiduyun nginx-1.15.2]# ./configure --prefix=/opt/nginx --user=www --group=www --with-http_ssl_module --with-http_realip_module

[root@baiduyun nginx-1.15.2]# make

[root@baiduyun nginx-1.15.2]# cp /opt/nginx/sbin/nginx{,.old}

[root@baiduyun nginx-1.15.2]# cd objs/

[root@baiduyun objs]# cp -rfp nginx /opt/nginx/sbin/nginx

cp: overwrite `/opt/nginx/sbin/nginx'? y

[root@baiduyun objs]# /opt/nginx/sbin/nginx -V

nginx version: nginx/1.15.2

built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) 

built with OpenSSL 1.0.1e-fips 11 Feb 2013

TLS SNI support enabled

configure arguments: --prefix=/opt/nginx --user=www --group=www --with-http_ssl_module --with-http_realip_module


点评
还没有点评哦!