ts7758258 发表于 2017-12-22 17:41:15

nginx升级至1.12.1版本

  nginx升级至1.12.1
  编号
  名称
  说明
  1
  nginx-1.12.1.tar.gz
  nginx安装程序
  2
  nginx_upstream_check_module-master.zip
  实现后端服务器的健康检查
  3
  nginx-sticky-module-ng-1.2.5.zip
  实现Cookie会话黏贴(session-sticky效果)
  4
  ngx_cache_purge-master.zip
  实现更强大的缓存清除功能
  注意:必须使用最新的nginx_upstream_check_module才支持nginx 1.12.1版本
  下载nginx_upstream_check_module
  

https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master  

  1、解压软件
  

tar zxvf nginx-1.12.1.tar.gz  
unzip nginx
-sticky-module-ng-1.2.5.zip  
mv nginx
-goodies-nginx-sticky-module-ng-08a395c66e42/ nginx-sticky-module-ng-1.2.5  
unzip nginx_upstream_check_module
-master  
unzip ngx_cache_purge
-master.zip  

  2、编译安装
  

cd nginx-1.12.1/  
patch
-p0 < ../nginx_upstream_check_module-master/check_1.11.5+.patch  
结果
  
patching file src
/http/modules/ngx_http_upstream_hash_module.c  
patching file src
/http/modules/ngx_http_upstream_ip_hash_module.c  
patching file src
/http/modules/ngx_http_upstream_least_conn_module.c  
patching file src
/http/ngx_http_upstream_round_robin.c  
patching file src
/http/ngx_http_upstream_round_robin.h  

  

cd ../nginx-sticky-module-ng-1.2.5  
patch
-p0 < ../nginx_upstream_check_module-master/nginx-sticky-module.patch  
结果
  
patching file ngx_http_sticky_module.c
  
Hunk #
1 succeeded at 15 with fuzz 2 (offset 5 lines).  
Hunk #
2 succeeded at 304 (offset 12 lines).  
Hunk #
3 succeeded at 330 (offset 12 lines).  
Hunk #
4 succeeded at 352 (offset 12 lines).  

  

cd ../nginx-1.12.1  
.
/configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --add-module=/root/nginx_upstream_check_module-master --add-module=/root/nginx-sticky-module-ng-1.2.5 --add-module=/root/ngx_cache_purge-master  
make
  

  3、备份旧版nginx文件,将新版本的nginx可执行文件复制到nginx的sbin目录
  

cp -a /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak  

  4、停止nginx服务,替换nginx执行文件
  

/usr/local/nginx/sbin/nginx -s stop  

  
cd
/root/nginx-1.12.1/objs  
cp
-a nginx /usr/local/nginx/sbin/nginx  

  欢迎转载,转载请注明出自:
  nginx升级至1.12.1版本 - paul_hch - 博客园
  http://www.cnblogs.com/paul8339/p/7161316.html
页: [1]
查看完整版本: nginx升级至1.12.1版本