参考: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/

相关文章:

  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2021-08-27
猜你喜欢
  • 2022-12-23
  • 2021-06-22
  • 2021-12-11
  • 2021-12-04
  • 2022-03-05
  • 2021-12-24
相关资源
相似解决方案