Javatpoint Logo
Javatpoint Logo

NGINX Dynamic Modules

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):

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.

2. Add the following directive in the top level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:

3. Perform some additional configuration as required by the module.

4. To enable the module, reload Nginx Plus:


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:

For Debian or Ubuntu:

For SLES:

2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:

3. Perform some additional configuration as required by the module.

4. To enable the module, reload Nginx Plus:


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:

For Debian or Ubuntu:

For SLES:

2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:

3. Perform some additional configuration as required by the module.

4. To enable the module, reload Nginx Plus:


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:

For Debian or Ubuntu:

For SLES:

2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:

3. Perform some additional configuration as required by the module.

4. To enable the module, reload Nginx Plus:


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:

For Debian or Ubuntu:

2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:

3. Perform some additional configuration as required by the module.

4. To enable the module, reload Nginx Plus:


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:

For Debian or Ubuntu:

For SLES:

2. Add the following directive in the top-level ("main") context of the main Nginx Plus configuration file /etc/nginx/nginx.conf:

3. Perform some additional configuration as required by the module.

4. To enable the module, reload Nginx Plus:


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:

For Debian and Ubuntu:

For SLES:

2. Add the following directive in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:

3. Perform additional configuration as required by the module.

4. To enable the module, reload NGINX Plus:


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:

For Debian and Ubuntu:

For SLES:

2. Add both of the following directives in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:

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:


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:

For Debian/Ubuntu:

For SLES:

2. Add the following directive in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:

3. Perform additional configuration as required by the module.

4. To enable the module to reload NGINX Plus:


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:

For Debian and Ubuntu:

For SLES:

2. Add the following directive in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:

3. Perform additional configuration as required by the module.

4. To enable the module, Reload NGINX Plus:


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:

For Debian and Ubuntu:

For SLES:

2. Add both of the following directives in the top-level ("main") context of the main NGINX Plus configuration file, /etc/nginx/nginx.conf:

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:






Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA