Nginx Plus is a modular architecture. We can include new features and functionality with software modules, which can be plugged into a running Nginx Plus instance on demand.
Dynamic modules include functionality to Nginx Plus such as geolocating users by IP address, resizing images, and embedding Lua scripts into the Nginx Plus event processing model. Modules are created both by Nginx, incorporation and third-party developers.
With the help of dynamic modules, we can load separate shared object files at runtime as modules - both third party modules as well as some native Nginx modules.
The next Nginx Plus release will build on this dynamic modules feature. Nginx Plus has a managed modules repository with a range of third party modules that we have tested and certified against Nginx Plus, making it easier for us to add common extensions to Nginx Plus with confidence.
Displaying the List of Available Modules
To display the list of available modules, run the following command (for Debian or Ubuntu OS):
$ apt-cache search nginx-plus-module
nginx-plus-module-geoip - NGINX Plus, provided by Nginx, Inc. (GeoIP dynamic modules)
nginx-plus-module-geoip-dbg - Debugging symbols for the nginx-plus-module-geoip
nginx-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-geoip2
nginx-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-more
nginx-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
Let's see the list of some important dynamic modules:
Brotli
Brotli is a general-purpose, lossless data compression algorithm that uses a variant of the Huffman coding, LZ77 algorithm, and second-order context modeling. Its compression ratio is comparable to the best currently available general-purpose compression methods.
Installation Steps:
1. First, install the Brotli module.
$ apt-get install nginx-plus-module-brotli
2. Add the following directive in the top level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
3. Perform some additional configuration as required by the module.
4. To enable the module, reload Nginx Plus:
$ nginx -t && nginx -s reload
Cookie-Flag
Set the flags HttpOnly, secure and SameSite for cookies in Set-Cookie upstream response headers.
Installation Steps:
1. Install the Cookie-Flag module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-cookie-flag
For Debian or Ubuntu:
$ apt-get install nginx-plus-module-cookie-flag
For SLES:
$ zypper install nginx-plus-module-cookie-flag
2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:
load_module modules/ngx_http_cookie_flag_filter_module.so;
3. Perform some additional configuration as required by the module.
4. To enable the module, reload Nginx Plus:
$ nginx -t && nginx -s reload
Encrypted-Session
This dynamic module gives some encryption and decryption support for Nginx variables based on AES-256 with MAC. It is usually used with the Set-Misc dynamic module and the Nginx rewrite module.
Installation Steps:
1. Install the Encrypted - Session Module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-encrypted-session
For Debian or Ubuntu:
$ apt-get install nginx-plus-module-encrypted-session
For SLES:
$ zypper install nginx-plus-module-encrypted-session
2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_encrypted_session_module.so;
3. Perform some additional configuration as required by the module.
4. To enable the module, reload Nginx Plus:
$ nginx -t && nginx -s reload
GeoIP
Create variable based on the IP address of the client, using the precompiled MaxMind GeoIP databases, for both Http and TCP/UDP traffic:
Installation Steps:
1. Install the GeoIP module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-geoip
For Debian or Ubuntu:
$ apt-get install nginx-plus-module-geoip
For SLES:
$ zypper install nginx-plus-module-geoip
2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_stream_geoip_module.so;
3. Perform some additional configuration as required by the module.
4. To enable the module, reload Nginx Plus:
$ nginx -t && nginx -s reload
GeoIP2
Create variable based on the IP address of the client, using the precompiled MaxMind GeoIP2 databases, which provides localized name information not present in the original GeoIP databases.
Installation Steps:
1. Install the GeoIP2 module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-geoip2
For Debian or Ubuntu:
$ apt-get install nginx-plus-module-geoip2
2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:
load_module modules/ngx_http_geoip2_module.so;
load_module modules/ngx_stream_geoip2_module.so;
3. Perform some additional configuration as required by the module.
4. To enable the module, reload Nginx Plus:
$ nginx -t && nginx -s reload
Headers-More
It is used to set and clear the input and output headers, for extending core Headers module:
Installation Steps:
1. Install the Headers-More module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-headers-more
For Debian or Ubuntu:
$ apt-get install nginx-plus-module-headers-more
For SLES:
$ zypper install nginx-plus-module-headers-more
2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:
load_module modules/ngx_http_headers_more_filter_module.so;
3. Perform some additional configuration as required by the module.
4. To enable the module, reload Nginx Plus:
$ nginx -t && nginx -s reload
Image-Filter
Crop, rotate, resize and perform other transformations of GIF, JPEG, and PNG images.
Installation Steps:
1. Install the Image-Filter module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-image-filter
For Debian and Ubuntu:
$ apt-get install nginx-plus-module-image-filter
For SLES:
$ zypper install nginx-plus-module-image-filter
2. Add the following directive in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:
load_module modules/ngx_http_image_filter_module.so;
3. Perform additional configuration as required by the module.
4. To enable the module, reload NGINX Plus:
$ nginx -t && nginx -s reload
Lua
Integrate Lua co-routines into the event-processing Module of Nginx.
Installation Steps:
1. Install the Lua module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-lua
For Debian and Ubuntu:
$ apt-get install nginx-plus-module-lua
For SLES:
$ zypper install nginx-plus-module-lua
2. Add both of the following directives in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_lua_module.so;
Note: The directives must be in the above order.
3. Perform additional configuration as required by the module.
4. Reload NGINX Plus to enable the module:
$ nginx -t && nginx -s reload
Perl
Implement location and variable handlers in Perl, and insert Perl calls into SSI (Server Side Includes).
Installation Steps:
1. Install the Perl module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-perl
For Debian/Ubuntu:
$ apt-get install nginx-plus-module-perl
For SLES:
$ zypper install nginx-plus-module-perl
2. Add the following directive in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:
load_module modules/ngx_http_perl_module.so;
3. Perform additional configuration as required by the module.
4. To enable the module to reload NGINX Plus:
$ nginx -t && nginx -s reload
RTMP
Stream RTMP (Real Time Messaging Protocol), Apple HTTP Live Streaming (HLS), and Dynamic Adaptive Streaming over HTTP (DASH) video formats.
Installation Steps:
1. Install the RTMP Media Streaming module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-rtmp
For Debian and Ubuntu:
$ apt-get install nginx-plus-module-rtmp
For SLES:
$ zypper install nginx-plus-module-rtmp
2. Add the following directive in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:
load_module modules/ngx_rtmp_module.so;
3. Perform additional configuration as required by the module.
4. To enable the module, Reload NGINX Plus:
$ nginx -t && nginx -s reload
Set-Misc
Implement numerous additional set_* directives, by extending the Nginx core Rewrite module.
Installation Steps:
1. Install the Set-Misc module.
For CentOS, Amazon Linux, Oracle Linux, and RHEL:
$ yum install nginx-plus-module-set-misc
For Debian and Ubuntu:
$ apt-get install nginx-plus-module-set-misc
For SLES:
$ XXXipper install nginx-plus-module-set-misc
2. Add both of the following directives in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:
load_module modules/ndk_http_module.so;
load_module modules/ngx_http_set_misc_module.so;
Note: The directives must be in this order.
3. Perform additional configuration as required by the module.
4. Reload NGINX Plus to enable the module:
$ nginx -t && nginx -s reload