已经编译安装的nginx/tenginx编译增加新模块
只适用于自行编译安装的nginx配置
业务变更带来的Nginx增加模块需求
由于业务从php转为go开发,需要用到Http2的协议。这种协议在Nginx上需要http_v2_module
这个模块的支持,但是现有服务器上,查看Nginx的编译参数中,并未添加。所以需要再次编译替换nginx
[root@ip-172-60-0-193 ~]# nginx -V
Tengine version: Tengine/2.3.2
nginx version: nginx/1.17.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/data/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --add-module=modules/ngx_http_reqstat_module --add-module=modules/ngx_http_user_agent_module --add-module=modules/ngx_http_upstream_check_module --add-module=modules/ngx_http_upstream_dynamic_module --add-module=modules/ngx_http_upstream_session_sticky_module --add-module=modules/ngx_http_upstream_consistent_hash_module --with-pcre=/root/web/pcre-8.37
从以上命令的输出中,可以看到。当前的Nginx并未添加http_v2_module
模块的支持
为nginx添加新的模块
找到当时编译安装的Nginx源码,或者相同版本的源码包。解压后,进行重新编译
编译时,使用之前的编译参数,并添加上对于新模块的支持
cd tengine-2.3.2
# 使用新的编译参数
./configure --user=www --group=www --prefix=/data/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --add-module=modules/ngx_http_reqstat_module --add-module=modules/ngx_http_user_agent_module --add-module=modules/ngx_http_upstream_check_module --add-module=modules/ngx_http_upstream_dynamic_module --add-module=modules/ngx_http_upstream_session_sticky_module --add-module=modules/ngx_http_upstream_consistent_hash_module --with-pcre=/root/web/pcre-8.37
进行make。一定要注意,不能进行
make install
# 上边编译没有报错的话,进行make
make
关闭现有的Nginx,并进行nginx二进制文件的替换
# make成功后,新的nginx二进制,在编译目录的objs目录下
# 查看编译后的Nginx,都支持哪些模块
objs/nginx -m Tengine version: Tengine/2.3.2
nginx version: nginx/1.17.3
nginx: loaded modules:
nginx: ngx_core_module (static)
...
nginx: ngx_http_v2_module (static)
... # 可以看到我们新编译后的nginx,已经添加好了我们需要的模块
systemctl stop nginx cd nginx/sbin
cp nginx nginx_old
mv ${make_dir}/objs/nginx nginx/sbin systemctl start nginx
查看替换后的Nginx,对于新模块的支持
# 再次查看当前系统上Nginx的模块
nginx -m nginx -V
到这里,整个Nginx重新编译安装增加新模块操作已完成。其他模块也可以按照此操作执行
已经编译安装的nginx/tenginx编译增加新模块的更多相关文章
- centos6.5生产环境编译安装nginx-1.11.3并增加第三方模块ngx_cache_purge、nginx_upstream_check、ngx_devel_kit、lua-nginx
1.安装依赖包 yum install -y gcc gcc-c++ pcre-devel openssl-devel geoip-devel 2.下载需要的安装包 LuaJIT-2.0.4.zip ...
- 在已经安装的nginx上,增加ssl模块
1. /usr/local/nginx/sbin/nginx -V 查看nginx版本与编译安装了哪些模块nginx version: nginx/1.10.3built by gcc 4.4.7 2 ...
- Nginx之编译安装的nginx加入systemctl
编译安装的nginx需要添加rc.local 编译安装后设置 /usr/lib/systemd/system/nginx.service [Unit] Description=nginx After= ...
- 20190418 CentOS7实用技能综合:系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/RocketMQ/RabbitMQ编译安装 + ...各类常用生产环境软件的编译安装
系统安装 + WinScp客户端连接 + 防火墙端口号iptables + Nginx编译安装 + MySQL编译安装 + Redis编译安装 + MongoDB编译安装 + ActiveMQ/Roc ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6
Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25
所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src ...
- CentOS6.3 编译安装LAMP(3):编译安装 MySQL5.5.25
所需源码包: /usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz /usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.g ...
- CentOS6.3 编译安装LAMP(4):编译安装 PHP5.2.17
所需源码包: /usr/local/src/PHP-5.2.17/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.2.17/mhash-0.9.9.9.tar. ...
- CentOS6.3 编译安装LAMP(4):编译安装 PHP5.3.27
所需源码包: /usr/local/src/PHP-5.3.27/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.3.27/mhash-0.9.9.9.tar. ...
随机推荐
- Mysql中 int(3) 类型的含义
注意:这里的(3)代表的并不是存储在数据库中的具体的长度,以前总是会误以为int(3)只能存储3个长度的数字,int(11)就会存储11个长度的数字,这是大错特错的. 其实当我们在选择使用int的类型 ...
- Batch批处理 间断向EXE发送参数
参考:https://blog.csdn.net/wjz1029/article/details/45044033 找了很久的一种方法: 怎样向一个EXE 发送一个参数,得到反馈后,再向EXE发送一个 ...
- C++extern关键字理解
extern是一种"外部声明"的关键字,字面意思就是在此处声明某种变量或函数,在外部定义. 下面的示意图是我的理解. extern关键字的主要作用是扩大变量/函数的作用域,使得其它 ...
- spring-boot-route(十二)整合redis做为缓存
redis简介 redis作为一种非关系型数据库,读写非常快,应用十分广泛,它采用key-value的形式存储数据,value常用的五大数据类型有string(字符串),list(链表),set(集合 ...
- RHSA-2018:1200-重要: patch 安全更新(代码执行)
[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) 修复命令: 使用root账号登陆She ...
- JVM 第五篇:命令行 JVM 故障处理工具
本文内容过于硬核,建议有 Java 相关经验人士阅读. 1. 引言 虽然我们前面介绍了各种图形化 JVM 故障处理工具,但是很多情况下,我们在处理问题的时候并没有图形化的操作环境可以使用,这时候,就需 ...
- Rust之路(4)——所有权
[未经书面同意,严禁转载] -- 2020-10-14 -- 所有权是Rust的重中之重(这口气咋像高中数学老师 WTF......). 所有权是指的对内存实际存储的数据的访问权(包括读取和修改),在 ...
- day32 Pyhton 异常处理
一.内容回顾 反射的另外两个内置函数 setattr delattr a.b=c 与 setattr(a,'b',c)相对 del a.b 与 delattr(a,'b') 两个内置函数 A,B(A) ...
- elk-安装 通过docker
一. github地址 https://github.com/deviantony/docker-elk cd /usr/local/src git clone https://git ...
- docker系统化学习图文+视频教程
1.背景 博客对应的视频课程: 9.9元在线学习:https://study.163.com/course/courseMain.htm?share=2&shareId=40000000033 ...