NGINX动态模块

本文概述

  • 布罗特利
  • 曲奇标志
  • 加密会话
  • GeoIP
  • GeoIP2
  • 标头-更多
  • 图像滤镜
  • 佩尔
  • RTMP
  • 集杂项
Nginx Plus是一种模块化架构。我们可以在软件模块中包含新功能, 可以根据需要将其插入正在运行的Nginx Plus实例中。
动态模块包括Nginx Plus的功能, 例如通过IP地址对用户进行地理位置定位, 调整图像大小以及将Lua脚本嵌入到Nginx Plus事件处理模型中。模块由Nginx, 公司和第三方开发人员创建。
借助动态模块, 我们可以在运行时将单独的共享库文件作为模块加载-第三方模块以及某些本机Nginx模块。
下一个Nginx Plus版本将基于此动态模块功能。 Nginx Plus拥有一个托管模块存储库, 其中包含一系列经过我们针对Nginx Plus进行测试和认证的第三方模块, 这使我们更容易放心地向Nginx Plus添加通用扩展。
显示可用模块列表
要显示可用模块的列表, 请运行以下命令(对于Debian或Ubuntu OS):
$ apt-cache search nginx-plus-modulenginx-plus-module-geoip - NGINX Plus, provided by Nginx, Inc. (GeoIP dynamic modules)nginx-plus-module-geoip-dbg - Debugging symbols for the nginx-plus-module-geoipnginx-plus-module-geoip2 - NGINX Plus, provided by Nginx, Inc. (3rd-party GeoIP2 dynamic modules)nginx-plus-module-geoip2-dbg - Debugging symbols for the nginx-plus-module-geoip2nginx-plus-module-headers-more - NGINX Plus, provided by Nginx, Inc. (3rd-party headers-more dynamic module)nginx-plus-module-headers-more-dbg - Debugging symbols for the nginx-plus-module-headers-morenginx-plus-module-image-filter - NGINX Plus, provided by Nginx, Inc. (image filter dynamic module)nginx-plus-module-image-filter-dbg - Debugging symbols for the nginx-plus-module-image-filter

让我们看一些重要的动态模块的列表:
布罗特利Brotli是一种通用的无损数据压缩算法, 它使用了霍夫曼编码, LZ77算法和二阶上下文建模的变体。其压缩率可与当前最好的通用压缩方法相媲美。
安装步骤:
1.首先, 安装Brotli模块。
$ apt-get install nginx-plus-module-brotli

2.在Nginx Plus主配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_http_brotli_filter_module.so; load_module modules/ngx_http_brotli_static_module.so;

3.根据模块的要求执行一些其他配置。
4.要启用该模块, 请重新加载Nginx Plus:
$ nginx -t & & nginx -s reload

曲奇标志在Set-Cookie上游响应标头中为cookie设置标志HttpOnly, secure和SameSite。
安装步骤:
1.安装Cookie-Flag模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-cookie-flag

对于Debian或Ubuntu:
$ apt-get install nginx-plus-module-cookie-flag

对于SLES:
$ zypper install nginx-plus-module-cookie-flag

2.在Nginx Plus主配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_http_cookie_flag_filter_module.so;

【NGINX动态模块】3.根据模块的要求执行一些其他配置。
4.要启用该模块, 请重新加载Nginx Plus:
$ nginx -t & & nginx -s reload

加密会话这个动态模块为基于MAC的AES-256的Nginx变量提供了一些加密和解密支持。它通常与Set-Misc动态模块和Nginx重写模块一起使用。
安装步骤:
1.安装加密的会话模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-encrypted-session

对于Debian或Ubuntu:
$ apt-get install nginx-plus-module-encrypted-session

对于SLES:
$ zypper install nginx-plus-module-encrypted-session

2.在Nginx Plus主配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ndk_http_module.so; load_module modules/ngx_http_encrypted_session_module.so;

3.根据模块的要求执行一些其他配置。
4.要启用该模块, 请重新加载Nginx Plus:
$ nginx -t & & nginx -s reload

GeoIP使用预编译的MaxMind GeoIP数据库, 基于客户端的IP地址为Http和TCP / UDP流量创建变量:
安装步骤:
1.安装GeoIP模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-geoip

对于Debian或Ubuntu:
$ apt-get install nginx-plus-module-geoip

对于SLES:
$ zypper install nginx-plus-module-geoip

2.在Nginx Plus主配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_http_geoip_module.so; load_module modules/ngx_stream_geoip_module.so;

3.根据模块的要求执行一些其他配置。
4.要启用该模块, 请重新加载Nginx Plus:
$ nginx -t & & nginx -s reload

GeoIP2使用预编译的MaxMind GeoIP2数据库, 基于客户端的IP地址创建变量, 该数据库提供原始GeoIP数据库中不存在的本地化名称信息。
安装步骤:
1.安装GeoIP2模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-geoip2

对于Debian或Ubuntu:
$ apt-get install nginx-plus-module-geoip2

2.在Nginx Plus主配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_http_geoip2_module.so; load_module modules/ngx_stream_geoip2_module.so;

3.根据模块的要求执行一些其他配置。
4.要启用该模块, 请重新加载Nginx Plus:
$ nginx -t & & nginx -s reload

标头-更多它用于设置和清除输入和输出标头, 以扩展核心标头模块:
安装步骤:
1.安装页眉更多模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-headers-more

对于Debian或Ubuntu:
$ apt-get install nginx-plus-module-headers-more

对于SLES:
$ zypper install nginx-plus-module-headers-more

2.在Nginx Plus主配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_http_headers_more_filter_module.so;

3.根据模块的要求执行一些其他配置。
4.要启用该模块, 请重新加载Nginx Plus:
$ nginx -t & & nginx -s reload

图像滤镜裁剪, 旋转, 调整大小并执行GIF, JPEG和PNG图像的其他转换。
安装步骤:
1.安装图像过滤器模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-image-filter

对于Debian和Ubuntu:
$ apt-get install nginx-plus-module-image-filter

对于SLES:
$ zypper install nginx-plus-module-image-filter

2.在主NGINX Plus配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_http_image_filter_module.so;

3.根据模块要求执行其他配置。
4.要启用该模块, 请重新加载NGINX Plus:
$ nginx -t & & nginx -s reload

拿将Lua协同例程集成到Nginx的事件处理模块中。
安装步骤:
1.安装Lua模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-lua

对于Debian和Ubuntu:
$ apt-get install nginx-plus-module-lua

对于SLES:
$ zypper install nginx-plus-module-lua

2.在主NGINX Plus配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下两个指令:
load_module modules/ndk_http_module.so; load_module modules/ngx_http_lua_module.so;

注意:指令必须按上述顺序。3.根据模块要求执行其他配置。
4.重新加载NGINX Plus以启用该模块:
$ nginx -t & & nginx -s reload

佩尔在Perl中实现位置和变量处理程序, 并将Perl调用插入SSI(服务器端包含)。
安装步骤:
1.安装Perl模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-perl

对于Debian / Ubuntu:
$ apt-get install nginx-plus-module-perl

对于SLES:
$ zypper install nginx-plus-module-perl

2.在主NGINX Plus配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_http_perl_module.so;

3.根据模块要求执行其他配置。
4.要使模块重新加载NGINX Plus:
$ nginx -t & & nginx -s reload

RTMP流RTMP(实时消息协议), Apple HTTP实时流(HLS)和基于HTTP的动态自适应流(DASH)视频格式。
安装步骤:
1.安装RTMP媒体流模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-rtmp

对于Debian和Ubuntu:
$ apt-get install nginx-plus-module-rtmp

对于SLES:
$ zypper install nginx-plus-module-rtmp

2.在主NGINX Plus配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下指令:
load_module modules/ngx_rtmp_module.so;

3.根据模块要求执行其他配置。
4.要启用该模块, 请重新加载NGINX Plus:
$ nginx -t & & nginx -s reload

集杂项通过扩展Nginx核心重写模块, 实现许多其他set_ *指令。
安装步骤:
1.安装Set-Misc模块。
对于CentOS, Amazon Linux, Oracle Linux和RHEL:
$ yum install nginx-plus-module-set-misc

对于Debian和Ubuntu:
$ apt-get install nginx-plus-module-set-misc

对于SLES:
$ XXXipper install nginx-plus-module-set-misc

2.在主NGINX Plus配置文件/etc/nginx/nginx.conf的顶级(” main” )上下文中添加以下两个指令:
load_module modules/ndk_http_module.so; load_module modules/ngx_http_set_misc_module.so;

注意:指令必须按此顺序。3.根据模块要求执行其他配置。
4.重新加载NGINX Plus以启用该模块:
$ nginx -t & & nginx -s reload

    推荐阅读