nginx升級至1.12.1html
編號nginx |
名稱git |
說明github |
1後端 |
nginx-1.12.1.tar.gz緩存 |
nginx安裝程序服務器 |
2session |
nginx_upstream_check_module-master.zipspa |
實現後端服務器的健康檢查code |
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
一、解壓軟件
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
二、編譯安裝
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
三、備份舊版nginx文件,將新版本的nginx可執行文件複製到nginx的sbin目錄
cp -a /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
四、中止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