Enabling various modules
Besides the http
and mail
modules, there are a number of other modules included in the NGINX distribution. These modules are not activated by default, but may be enabled by setting the appropriate configuration option:
--with-<module-name>_module
Table – HTTP module configure options
Option |
Explanation |
---|---|
|
If you need to encrypt web traffic, you will need this option to be able to use URLs beginning with |
|
If your NGINX is behind an L7 load balancer or other device that passes the client's IP address in an HTTP header, you will need to enable this module. For use in situations where multiple clients appear to come from one IP address. |
|
This module works as an output filter, enabling you to add content of a different location before or after that of the location itself. |
|
This module will handle transformations of XML responses, based on one or more XSLT stylesheets. (Requires the libxml2 and libxslt libraries.) |
|
This module is able to act as a filter on images, processing them before handing them over to the client. (Requires the |
|
With this module, you are able to set various variables to use in configuration blocks to make decisions based on the geographic location found for a client's IP address. (Requires the |
|
This module implements a substitution filter, replacing one string in the response with another. (A word of caution: using this module implicitly disables the caching of headers.) |
|
Enabling this module will activate the configuration directives for using WebDAV. Note that this module should only be enabled on a need-to-use basis, as it could present security problems if configured incorrectly. |
|
If you need to be able to stream Flash video files, this module will provide pseudo-streaming. |
|
This module supports pseudo-streaming for H.264/AAC files. |
|
Use this module if you would like to support sending pre-compressed versions of static files when the resource is called without the |
|
This module will decompress pre-compressed content for clients that do not support |
|
If you would like to serve an index file chosen at random from the files in a directory, then this module needs to be enabled. |
|
This module provides a mechanism to hash a link to a URL, so that only those with the proper password would be able to calculate the link. |
|
Enabling this module will help you gather statistics from NGINX itself. The output can be graphed using |
As you can see, these are all modules that build upon the http
module, providing extra functionality. Enabling the modules at compile time should not affect runtime performance at all. Using the modules later in the configuration is where performance may be impacted.
I would therefore recommend the following configure
options for a web accelerator/proxy:
$ ./configure --with-http_ssl_module --with-http_realip_module --with-http_geoip_module --with-http_stub_status_module --with-openssl=${BUILD_DIR}/openssl-1.0.1p
And the following for a web server:
$ ./configure --with-http_stub_status_module
The difference lies in where NGINX will be faced with clients. The web acceleration role takes care of terminating SSL requests as well as dealing with proxied clients and making decisions based on where a client came from. The web server role only needs to provide default file serving capability.
I would recommend always enabling the stub_status
module, as it provides a means of gathering metrics on how your NGINX is performing.
Disabling unused modules
There are also a number of http
modules that are normally activated, but may be disabled by setting the appropriate configuration option --without-<module-name>_module
. If you have no use for these modules in your configuration, you can safely disable them.
Table – Disable configure options
Option |
Explanation |
---|---|
|
The
|
|
The |
|
This module is a filter that processes Server Side Includes. If the Perl module is enabled, an additional SSI command ( |
|
The |
|
The |
|
This module limits access via HTTP Basic Authentication. |
|
The |
|
This module enables you to set up configuration variables based on a client's IP address and then take action on the value of those variables. |
|
The map module enables you to map one variable to another. |
|
This module creates variables that can be used for A/B testing. |
|
This module enables NGINX to block requests based on the Referer HTTP header. |
|
The |
|
The |
|
The FastCGI module enables NGINX to pass requests to a FastCGI server. |
|
This module enables NGINX to pass requests to a uWSGI server. |
|
The SCGI module enables NGINX to pass requests to an SCGI server. |
|
This module enables NGINX to interact with a memcached server, placing responses to queries into a variable. |
|
This module enables NGINX to set connection limits based on certain keys, usually an IP address. |
|
With this module, NGINX can limit the request rate per key. |
|
The empty GIF module produces a 1 x 1-pixel in-memory transparent GIF. |
|
The browser module allows for configurations based on the User-Agent HTTP request header. Variables are set based on the version found in this header. |
|
This module defines a set of servers that may be used in conjunction with the various proxy modules. |