通过nginx 动态加载stream模块

发布时间:2024-12-04 11:31

分模块学习,避免信息过载 #生活技巧# #学习技巧# #跨学科学习技巧#

最新推荐文章于 2024-11-02 11:26:33 发布

李浩的life 于 2018-08-21 15:02:48 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

Ngix1.9.11开始增加加载动态模块支持,从此不再需要替换nginx文件即可增加第三方扩展。目前官方只有几个模块支持动态加载,第三方模块需要升级支持才可编译成模块。
我们测试下通过nginx动态加载模块,添加stream模块实现tcp 反向代理功能。

查看支持

./configure --help | grep dynamic --with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module --with-http_image_filter_module=dynamic enable dynamic ngx_http_image_filter_module --with-http_geoip_module=dynamic enable dynamic ngx_http_geoip_module --with-http_perl_module=dynamic enable dynamic ngx_http_perl_module --with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module --with-stream=dynamic enable dynamic TCP/UDP proxy module --with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module --add-dynamic-module=PATH enable dynamic external module --with-compat dynamic modules compatibility1234567891011 动态加载stream模块

nginx -V nginx version: nginx/1.12.0 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2l 25 May 2017 TLS SNI support enabled configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-openssl=/home/packet/lnmp1.4-full/src/openssl-1.0.2l123456

在原始参数后面添加 –with-stream=dynamic

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-openssl=/home/packet/lnmp1.4-full/src/openssl-1.0.2l --with-stream=dynamic1

make编译 ,切记不要install
当前目录objs中会存在 编译好的 ngx_stream_module.so

cp ngx_stream_module.so nginx_worker_dir/modules/1 更改配置

load_module modules/ngx_stream_module.so; stream { upstream proxy_name { server 127.0.0.1:9553; } server { listen 8088; proxy_pass proxy_name; } }1234567891011

reload nginx 测试stream是否生效

网址:通过nginx 动态加载stream模块 https://www.yuejiaxmz.com/news/view/371969

相关内容

nginx error
家庭网络如何申请ssl
nginx 安全策略配置项
nginx 解决504超时问题
通过语音模块实现智能家居的语音控制
vue 项目中 动态加载图片src的解决方法
服务器Nginx并发压力测试工具AB测试WordPress站点
Stream ToMap(Collectors.toMap) 实践
【补充】Python的自动化工具Ansible
快乐方块屋家庭模拟器下载

随便看看