首页 技术 正文
技术 2022年11月21日
0 收藏 513 点赞 3,106 浏览 3213 个字

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..tar.gz
unzip nginx-sticky-module-ng-1.2..zip
mv nginx-goodies-nginx-sticky-module-ng-08a395c66e42/ nginx-sticky-module-ng-1.2.
unzip nginx_upstream_check_module-master
unzip ngx_cache_purge-master.zip

2、编译安装

cd nginx-1.12./
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.
patch -p0 < ../nginx_upstream_check_module-master/nginx-sticky-module.patch
结果
patching file ngx_http_sticky_module.c
Hunk # succeeded at with fuzz (offset lines).
Hunk # succeeded at (offset lines).
Hunk # succeeded at (offset lines).
Hunk # succeeded at (offset lines).
cd ../nginx-1.12.
./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. --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 stopcd /root/nginx-1.12./objs
cp -a nginx /usr/local/nginx/sbin/nginx

5、同时还可以隐藏nginx版本号

在http {—}里加上server_tokens off;

nginx升级至1.12.1版本

执行curl -I IP

nginx升级至1.12.1版本

nginx升级方法至1.16.1如下,建议在测试环境或备机执行测试。

1、查看现有nginx版本

/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.11.
built by gcc 4.4. (Red Hat 4.4.-) (GCC)
built with OpenSSL 1.0.2j Sep
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.0.2j --with-pcre=/usr/local/src/pcre-8.38 --add-module=/usr/local/src/ngx_cache_purge-2.3 --with-http_gzip_static_module

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

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

3、下载,解压并安装新版本nginx-1.16.1,及相关模块

tar -zxvf nginx-1.16..tar.gz
unzip nginx_upstream_check_module-master.zip

编译模块nginx_upstream_check_module

cd nginx-1.16.
patch -p0 < ../nginx_upstream_check_module-master/check_1.14.0+.patch

编译nginx(一定要按照原先编译参数进行编译)

./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.0.2j --with-pcre=/usr/local/src/pcre-8.38 --add-module=/usr/local/src/ngx_cache_purge-2.3 --with-http_gzip_static_module --add-module=/root/nginx_upstream_check_module-mastermake

此时不要执行make install,否则会覆盖nginx文件

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

/usr/local/nginx/sbin/nginx -s stop
cd /root/nginx-1.16./objs
cp -a nginx /usr/local/nginx/sbin/nginx

5、验证nginx版本及业务是否正常

/usr/local/nginx/sbin/nginx -V

欢迎转载,转载请注明出自:

nginx升级至1.12.1版本 – paul_hch – 博客园
http://www.cnblogs.com/paul8339/p/7161316.html

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,942
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,466
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,281
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,095
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,728
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,765