参考:https://www.cnblogs.com/Leechg/p/9969000.html

---------如下我的操作记录---------------

nginx -V查看当前nginx信息:

包括版本号和configure编译配置信息

nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
下载相同版本号的nginx源码 http://nginx.org/en/download.html 并解压
wget http://nginx.org/download/nginx-1.12.2.tar.gz

下载要加载的新的模块,本例为nginx-rtmp-module nginx实现直播服务的模块

git clone https://github.com/arut/nginx-rtmp-module.git

目录结构如下:

[root@zmdsdkhost rtmp]# ls
nginx-1.12.2 nginx-1.12.2.tar.gz nginx-rtmp-module

./configure 配置编译选项,在原有编译选项上增加--add-module=../nginx-rtmp-module-1.2.1

./configure  --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' --add-module=../nginx-rtmp-module

make  记住不要install !!!!!!!!!!!!!!!!!!!!!!!!!

编译后的nginx在当前目录的objs文件夹内。

ls objs/
addon ngx_http_geoip_module_modules.c ngx_http_perl_module_modules.o ngx_mail_module.so
autoconf.err ngx_http_geoip_module_modules.o ngx_http_perl_module.so ngx_modules.c
Makefile ngx_http_geoip_module.so ngx_http_xslt_filter_module_modules.c ngx_modules.o
nginx ngx_http_image_filter_module_modules.c ngx_http_xslt_filter_module_modules.o ngx_stream_module_modules.c
nginx.8 ngx_http_image_filter_module_modules.o ngx_http_xslt_filter_module.so ngx_stream_module_modules.o
ngx_auto_config.h ngx_http_image_filter_module.so ngx_mail_module_modules.c ngx_stream_module.so
ngx_auto_headers.h ngx_http_perl_module_modules.c ngx_mail_module_modules.o src

ls objs/

对已有nginx可执行文件进行替换

(base) [root@zmdsdkhost nginx-1.12.2]# which  nginx
/usr/sbin/nginx
(base) [root@zmdsdkhost nginx-1.12.2]# cd /usr/sbin/
(base) [root@zmdsdkhost sbin]# cp nginx{,.bak}
(base) [root@zmdsdkhost sbin]# cp /opt/rtmp/nginx-1.12.2/objs/nginx
nginx nginx.8
(base) [root@zmdsdkhost sbin]# cp /opt/rtmp/nginx-1.12.2/objs/nginx .
cp: overwrite ‘./nginx’? y
(base) [root@zmdsdkhost sbin]# ls nginx*
nginx nginx.bak

 

======问题记录=======

错误./configure: error: the HTTP rewrite module requires the PCRE library.

解决:安装pcre-devel:yum -y install pcre-devel

错误:./configure: error: the HTTP cache module requires md5 functions

from OpenSSL library. You can either disable the module by using 
–without-http-cache option, or install the OpenSSL library into the system, 
or build the OpenSSL library statically from the source with nginx by using 
–with-http_ssl_module –with-openssl= options.

解决:yum -y install openssl openssl-devel

错误:./configure: error: the HTTP XSLT module requires the libxml2/libxslt    缺少libxml2

解决:yum -y install libxml2 libxml2-devel && yum -y install libxslt-devel

错误信息:./configure: error: the HTTP image filter module requires the GD library. You can either do not enable the module or install the libraries.

解决方法:http_image_filter_module是nginx提供的集成图片处理模块,需要gd-devel的支持   yum -y install gd-devel

错误信息:./configure: error: perl module ExtUtils::Embed is required 缺少ExtUtils

解决方法:yum -y install perl-devel perl-ExtUtils-Embed

错误信息:./configure: error: the GeoIP module requires the GeoIP library. You can either do not enable the module or install the library. 缺少GeoIP

解决方法:yum -y install GeoIP GeoIP-devel GeoIP-data

错误信息:./configure: error: the Google perftools module requires the Google perftools
library. You can either do not enable the module or install the library.

解决方法:yum -y install gperftools

 

Nginx加载新的模块,编译报错记录的更多相关文章

  1. nginx加载字体文件的时候报错

    nginx 下加载配置 location ~* \.(eot|ttf|ttc|otf|eot|woff|woff2|svg)$ {                root /web/static_jr ...

  2. nginx添加nginx_mod_h264_streaming-2.2.7模块编译报错

    报错ngx_http_streaming_module.c:158: 错误:‘ngx_http_request_t’ 没有名为 ‘zero_in_uri’ 的成员.这需要修改nginx_mod_h26 ...

  3. ios 12 xcode10 新升级的编译报错libstdc++.6.0.9 Multiple commands produce

    问题一 编译报错 Showing Recent Messages :-1: Multiple commands produce '/Users/duning/Library/Developer/Xco ...

  4. 用eclipse加载别人的工程,报错Target runtime com.genuitec.runtime.generic.jee60 is not defined

    系统加载工程后,报错Target runtime com.genuitec.runtime.generic.jee60 is not defined,在发布工程的同事电脑上正常 新导入的工程,出问题很 ...

  5. antd按需加载,配置babel-plugin-import插件,编译后报错.bezierEasingMixin()解决方案

    报错如下: ./node_modules/antd/lib/button/style/index.less (./node_modules/css-loader??ref--6-oneOf-7-1!. ...

  6. 微信小程序---分包加载(subpackages)及报错

    某些情况下,开发者需要将小程序划分成不同的子包,在构建时打包成不同的分包,用户在使用时按需进行加载. 分包很简单,具体步骤如下: 在app.json中,创建subPackages,root表示分包A的 ...

  7. jfinal不能正确加载html网页,总是报错的解决方法

    今天自学jfinal,遇到一个很奇怪的问题,render("/index.html");总是报错. 仔细看错误日志,才发现原来是因为html网页放到了WEB-INF文件夹下面了,所 ...

  8. 记录一次win2003服务器的IIS服务加载.flv后缀的资源报错404的处理方法

    问题:访问某个域名下的xxxx.flv资源,页面报错404. 解决思路: 1.权限是否给足 user权限给完全控制咯 如果你访问该域名下的其他资源无问题的话就不是介个原因了 2.MIME类型是否少了 ...

  9. vue加载单文件使用vue-loader报错

    报错信息如下:ERROR in ./src/login.vue Module Error (from ./node_modules/vue-loader/lib/index.js): vue-load ...

随机推荐

  1. 解决install_github安装R包时无法打开(cannot open)URL?

    最近安装github上的R包,经常显示Error in utils::download.file(url, path, method = method, quiet = quiet, : 无法打开UR ...

  2. selenium+chrome抓取数据,运行js

    某些特殊的网站需要用selenium来抓取数据,比如用js加密的,破解难度大的 selenium支持linux和win,前提是必须安装python3,环境配置好 抓取代码: #!/usr/bin/en ...

  3. R语言中的正则表达式(转载:http://blog.csdn.net/duqi_yc/article/details/9817243)

    转载:http://blog.csdn.net/duqi_yc/article/details/9817243 目录 Table of Contents 1 正则表达式简介 2 字符数统计和字符翻译 ...

  4. 55. Binary Tree Preorder Traversal

    Binary Tree Preorder Traversal My Submissions QuestionEditorial Solution Total Accepted: 119655 Tota ...

  5. typora 图床配置方法

    学习计算机的同学,在日常学习中难免会记笔记,写文档.相信大家记笔记大部分使用的都是 Markdown 吧,如果到现在还没接触,那我强烈建议你去学习一下,大概几分钟就可以搞定它. 注:下文用到的所有软件 ...

  6. Identity Server 4 从入门到落地(四)—— 创建Web Api

    前面的部分: Identity Server 4 从入门到落地(一)-- 从IdentityServer4.Admin开始 Identity Server 4 从入门到落地(二)-- 理解授权码模式 ...

  7. 云原生PaaS平台通过插件整合SkyWalking,实现APM即插即用

    一. 简介 SkyWalking 是一个开源可观察性平台,用于收集.分析.聚合和可视化来自服务和云原生基础设施的数据.支持分布式追踪.性能指标分析.应用和服务依赖分析等:它是一种现代 APM,专为云原 ...

  8. javaSE中级篇2 — 工具类篇 — 更新完毕

    1.工具类(也叫常用类)-- 指的是别人已经写好了的,我们只需要拿来用就行了 官网网址:Overview (Java Platform SE 8 ) (oracle.com) ---- 但是这个是英文 ...

  9. OpenStack——云平台部署

    一.配置网络 准备:安装两台最小化的CentOS7.2的虚拟机,分别添加两张网卡,分别为仅主机模式和NAT模式,并且计算节点设置为4G运行内存,50G硬盘 1.控制节点--配置网络 控制节点第一个网卡 ...

  10. A Child's History of England.24

    Besides all these troubles, William the Conqueror was troubled by quarrels among his sons. He had th ...