一、nginx新版的下載
#下載頁面:
wget -c http://nginx.org/download/nginx-1.13.12.tar.gz
2、取得舊版nginx的設定
查看目前版本: /usr/local/nginx/sbin/nginx -v
/usr/local/ nginx/sbin/nginx -v
[root@zixuephp nginx-1.13.6]# /usr/local/nginx/sbin/nginx -v nginx version: nginx/1.13.6 [root@zixuephp nginx-1.13.6]# /usr/local/nginx/sbin/nginx -v nginx version: nginx/1.13.6 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 --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-pcre --with-http_ssl_module
三、解碼新版nginx原始碼套件
tar -xzvf nginx-1.13.12.tar.gz cd nginx-1.13.12
四、重新編譯新版前的設定
這裡的設定和舊版的一樣: /usr/local/nginx/sbin/nginx -v複製程式碼 程式碼如下:##./configure - -prefix=/usr/local/nginx --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_v2_module --with-http_gzip_static_module --with-http_sub_module - -with-pcre --with-http_ssl_module
五、編譯生成objs目錄,進入目錄,替換nginxmake
[root@zixuephp nginx-1.13.12]# ls auto changes changes.ru conf configure contrib html license makefile man objs readme src [root@zixuephp nginx-1.13.12]#
進入objs目錄,替換舊版的nginx主程式(在操作這裡前一定要先備份,免得出錯)
[root@zixuephp objs]#mv nginx /usr/local/nginx/sbin/nginx
make upgrade
以上是nginx編譯安裝後怎麼對nginx進行平滑升級的詳細內容。更多資訊請關注PHP中文網其他相關文章![root@zixuephp nginx-1.13.12]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.13.12
[root@zixuephp nginx-1.13.12]# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.13.12
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 --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-pcre --with-http_ssl_module