Nginx升級

(1)獲取舊版本Nginx 的 configure 選項;nginx

[root@localhost nginx]# sbin/nginx -Vui

nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module進程

(2)下載新版本Nginx 源碼包,對新版本的 Nginx源碼包進行預編譯、編譯。ip

[root@localhost src]# wget -c nginx.org/download/nginx-1.16.0.tar.gz #沒有wget命令能夠經過yum安裝 (yum install wget -y) ssl

[root@localhost src]# tar xf nginx-1.16.0.tar.gz get

[root@localhost src]# cd nginx-1.16.0 源碼

[root@localhost nginx-1.16.0]# ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_moduleit

[root@localhost nginx-1.16.0]# make io

(3)重命名舊版本nginx 的執行文件編譯

[root@localhost nginx-1.16.0]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

(4)複製新版本Nginx 的執行文件

[root@localhost nginx-1.16.0]# cp objs/nginx /usr/local/nginx/sbin/nginx

(5)平滑生效可執行文件

[root@localhost nginx-1.16.0]# kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`

#USR2參數:在老的進程號的基礎之上啓動新的進程。

(6)正常關閉老進程

[root@localhost nginx-1.16.0]# kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`

(7)查看Nginx 版本

[root@localhost nginx-1.16.0]# /usr/local/nginx/sbin/nginx -v

nginx version: nginx/1.16.0

相關文章
相關標籤/搜索