nginx 番外----添加第三方模块
#第三方模块需要先进行下载,然后再编译时指定文件目录
1.查看当前编译模块
root@nginx sbin]# ./nginx -V #查看当前添加模块
nginx version: nginx/1.14.
built by gcc 4.8. (Red Hat 4.8.-) (GCC)
configure arguments: --prefix=/nginx/ --add-module=/usr/local/src/nginx-1.14./echo-nginx-module-master
[root@nginx sbin]#
2.查看需要添加的模块
#本次添加的模块 ngx_stream_core_module 属于属于nginx 官方模块不需要下载,第三方模块需要下载解压
[root@nginx stream]# pwd
/usr/local/src/nginx-1.14./src/stream
[root@nginx stream]# ls
ngx_stream_access_module.c ngx_stream_split_clients_module.c
ngx_stream.c ngx_stream_ssl_module.c
ngx_stream_core_module.c ngx_stream_ssl_module.h
ngx_stream_geoip_module.c ngx_stream_ssl_preread_module.c
ngx_stream_geo_module.c ngx_stream_upstream.c
ngx_stream.h ngx_stream_upstream.h
ngx_stream_handler.c ngx_stream_upstream_hash_module.c
ngx_stream_limit_conn_module.c ngx_stream_upstream_least_conn_module.c
ngx_stream_log_module.c ngx_stream_upstream_round_robin.c
ngx_stream_map_module.c ngx_stream_upstream_round_robin.h
ngx_stream_proxy_module.c ngx_stream_upstream_zone_module.c
ngx_stream_realip_module.c ngx_stream_variables.c
ngx_stream_return_module.c ngx_stream_variables.h
ngx_stream_script.c ngx_stream_write_filter_module.c
ngx_stream_script.h
[root@nginx stream]#
3.添加 stream 模块进行重新编译
root@nginx sbin]# ./nginx -V
nginx version: nginx/1.14.
built by gcc 4.8. (Red Hat 4.8.-) (GCC)
configure arguments: --prefix=/nginx/ --add-module=/usr/local/src/nginx-1.14./echo-nginx-module-master
[root@nginx sbin]#
[root@nginx sbin]# cd /usr/local/src/nginx-1.14.2
[root@nginx nginx-1.14.2]# ls
auto CHANGES.ru configure echo-nginx-module-master html Makefile objs src
CHANGES conf contrib echo-nginx-module-master.zip LICENSE man README
#配置时需要将原先添加模块重新添加一遍
[root@nginx nginx-1.14.2]# ./configure --prefix=/nginx/ --add-module=/usr/local/src/nginx-1.14.2/echo-nginx-module-master --with-stream
4. 进行make操作
此处nginx源码目录为:/usr/local/src/nginx-1.14.2,即为编译命令执行目录。
make 此处一定不能使用make install命令,执行该命令会将原有nginx目录进行覆盖。
5. 停止nginx 服务,替换新的nginx 程序启动文件
[root@nginx nginx-1.14.]# cd /nginx/sbin/ #进入nginx 启动目录
[root@nginx sbin]# ls
nginx
[root@nginx sbin]# ./nginx -s stop #停止服务
nginx: [emerg] unknown directive "stream" in /nginx//conf/nginx.conf:51
[root@nginx sbin]# cp nginx nginx-no-stream #备份nginx 启动文件
[root@nginx sbin]# ls
nginx nginx-no-stream
[root@nginx sbin]# cp /usr/local/src/nginx-1.14.2/objs/nginx ./nginx #替换原有nginx 程序文件
cp: overwrite ‘./nginx’? y
[root@nginx sbin]#
root@nginx conf]# cd ../sbin
[root@nginx sbin]# ls
nginx nginx-no-stream
[root@nginx sbin]# ./nginx-no-stream -t #nginx --t 检查添加了 stream 字段的配置文件,原有文件报错
nginx: [emerg] unknown directive "stream" in /nginx//conf/nginx.conf:15
nginx: configuration file /nginx//conf/nginx.conf test failed
[root@nginx sbin]# ./nginx -t #nginx -t 检查添加了stream 字段的配置文件, 检查通过
nginx: the configuration file /nginx//conf/nginx.conf syntax is ok
nginx: configuration file /nginx//conf/nginx.conf test is successful
[root@nginx sbin]# ./nginx -V
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
configure arguments: --prefix=/nginx/ --add-module=/usr/local/src/nginx-1.14.2/echo-nginx-module-master --with-stream
[root@nginx sbin]#
nginx 番外----添加第三方模块的更多相关文章
- 玩玩 Nginx 2-----给Nginx添加第三方模块(动态更新upstream)
接上一篇,我们在初始化安装的时候添加了nginx_lua模块,然后了解到nginx不可以动态加载模块,所以当你安装第三方模块的时候需要覆盖nginx文件.接下来一起看看如何安装nginx第 ...
- yum安装的Nginx添加第三方模块支持tcp
需求:生产有个接口是通过socket通信.nginx1.9开始支持tcp层的转发,通过stream实现的,而socket也是基于tcp通信. 实现方法:Centos7.2下yum直接安装的nginx, ...
- yum安装下的nginx,如何添加模块,和添加第三方模块
需求:生产有个接口是通过socket通信.nginx1.9开始支持tcp层的转发,通过stream实现的,而socket也是基于tcp通信. 实现方法:Centos7.2下yum直接安装的nginx, ...
- Nginx网络架构实战学习笔记(四):nginx连接memcached、第三方模块编译及一致性哈希应用
文章目录 nginx连接memcached 第三方模块编译及一致性哈希应用 总结 nginx连接memcached 首先确保nginx能正常连接php location ~ \.php$ { root ...
- python永久添加第三方模块,PYTHONPATH的设置
今天用pip安装pymysql后遇到了一个问题,在PyCharm中import pymysql模块时,运行却提示我找不到pymysql mudule 我先考虑的是pymysql没有安装成功,但是cmd ...
- nginx添加第三方模块
原已经安装好的nginx,现在需要添加一个未被编译安装的模块: nginx -V 可以查看原来编译时都带了哪些参数,看看nginx是哪个版本,去下载一个nginx的源码,解压 原来的参数:--pref ...
- nginx重新编译添加ssl模块
https://www.cnblogs.com/zhming26/p/6278667.html https nginx配置 找到安装nginx的源码根目录,如果没有的话下载新的源码 http://ng ...
- NO.3_1:自学python之路------番外:第三方库安装、numpy
引言 Python因为pip的存在,使得第三方库的发布和获取都比较方便.并且Python对跨平台的支持,使得其相较于C++,Java更加方便使用.在本文中,将会介绍在Windows中安装第三方库的方法 ...
- 前端开发--nginx番外篇
Centos7下Nginx开发使用(背景: 阿里云ECS Centos7) 安装和启动 安装教程 Centos7安装Nginx实战 需要主意的如下: 文中第四步 4.配置编译参数命令:(可以使用./c ...
随机推荐
- C# 如何通过mailto标签和SMTP协议两种方式发送邮件
本文主要讲解如何通过如现mailto标签和SMTP协议两种方式发送邮件,下面就直入主题 方法一.通过mailto标签发送邮件 通过mailto不是正真意义上的发送邮件,它只是会自动调用我们本地默认的邮 ...
- Linux下查看设设置时间date命令
查看时间 # date "+%Y_%m_%d %H-%M-%S" 设置时间 #date -s "2018-05-17 09:51:50" //写入到硬件时钟 ...
- Java设计模式系列之装饰者模式
装饰者模式的定义 动态地将责任附加到对象上,若要扩展功能,装饰者提供了比继承更有弹性的替代方案 装饰者模式的UML类图 一般来说装饰者模式有下面几个参与者: Component:装饰者和被装饰者共同 ...
- poj 3525
多边形内最大半径圆. 哇没有枉费了我自闭了这么些天,大概五天前我看到这种题可能毫无思路抓耳挠腮举手投降什么的,现在已经能1A了哇. 还是先玩一会计算几何,刷个几百道 嗯这个半平面交+二分就阔以解决.虽 ...
- 10 windows server 2012R2 发布MVC框架网站注意事项
1:网站编译完成之后,需要发布,网站中应包括的文件有:文件夹(bin,Views,Content等其他网站中涉及到的文件夹)文件(favicon.ico.Web.config.Global.asax) ...
- swust oj 1015
堆排序算法 1000(ms) 10000(kb) 2631 / 5595 编写程序堆排序算法.按照从小到大的顺序进行排序,测试数据为整数. 输入 第一行是待排序数据元素的个数: 第二行是待排序的数据元 ...
- 实现Linux下的ls和ls-l
ls的C语言代码实现 #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #includ ...
- 如何解决PuTTY中文乱码的问题
我们可以使用PuTTY这个工具在一台机器上对其它linux系统进行连接和操作.如果大家都在linux系统中,可以在终端中用ssh ip或主机名直接连接. 如果要在windows中对远程的linux系统 ...
- python-----函数参数类型
#函数参数类型:1 位置参数 2 默认参数 3 关键字参数 4可变参数 包裹位置参数*args 包裹关键字参数 **kargs#参数位置顺序:先位置参数,默认参数,包裹位置,包裹关键字(定义和调用都应 ...
- Eclipse 00: 常用快捷键
Eclipse常用快捷键 1几个最重要的快捷键 代码助手:Ctrl+Space(简体中文操作系统是Alt+/)快速修正:Ctrl+1单词补全:Alt+/打开外部Java文档:Shift+F2 显示搜索 ...