Linux----------nginx平滑升級

1、nginx添加新模塊

1.查看已編譯參數並複製參數(user開始)
nginx -V
***  --usr=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module 


2.下載新的echo 模塊,並放入指定位置
wget https://github.com/chendao2015/echo-nginx-module下載
wget https://github.com/openresty/echo-nginx-module/archive/v0.61.tar.gz
mv echo-nginx-module-master /usr/local/src/nginx-1.8.1/echo-nginx-module

3.從新編譯參數          
./configure   --複製參數 --add-module=/usr/local/src/nginx-1.8.1/echo-nginx-module  
make
##這裏只須要make,必定不要make install,否則會覆蓋原有文件


4.備份原二進制文件,而後用新生成的二進制文件替換nginx二進制文件
cp /usr/local/nginx/sbin/nginx{,.old} 
\cp  /usr/loca/nginx-1.8.1/objs/nginx  /usr/local/nginx/sbin/nginx

5.從新啓動nginx
nginx -t  
nginx -s reload

2、升級nginx

1.備份原有nginx二進制文件
cp /usr/local/nginx/sbin/nginx{,.old} 

2.查看nginx編譯參數並複製參數
nginx -V
****  --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6

3.編譯安裝新版本nginx,安裝路徑需與舊版一致
./configure --prefix/usr/local/nginx-1.15 --複製參數
make 
##這裏只須要make,必定不要make install,否則會覆蓋原有文件

4.準備新版本nginx配置文件
cp /usr/local/nginx/conf/nginx.conf  /usr/local/nginx-1.15/conf/nginx.conf

5.殺死原有nginx進程,啓動新版本的nginx
pkill nginx
/usr/local/nginx-1.15/sbin/nginx
相關文章
相關標籤/搜索