You can choose which functionalities to include by selecting a set of modules. A module will be compiled as a Dynamic Shared Object (DSO) that exists from the main tengine binary. So you don't have to recompile tengine when you want to add or enable a functionality to it.
If you want to enable a standard module, you can enable it via configure's option while compiling tengine, for instance, --with-http_example_module or --with-http_examplemodule=shared. Run./configure --help_ for more details.
The maximum of dynamically loaded modules is limited to 128.
For now, only HTTP modules can be dynamically loaded.
This feature is tested only on Linux/FreeBSD/MacOS.
Syntax: path path
This directive specifies the default path (prefix) of DSO modules.
Sets the default path to
Syntax: _load [module_name] [modulepath]
The load directive loads the shared object file and enables the module. _modulename is the name of the DSO module, and _modulepath is the path of the DSO module.
The order in which the module is searched is as follows:
- the absolute path.
- relative path to the prefix specified by the 'path' directive.
- relative path to the default path (NGX_PREFIX/modules or path which is specified by the '--dso-path' configure option).
It will load the ngx_http_empty_gif_module from ngx_http_empty_gif_module.so, ngx_http_test_module and ngx_http_test2_module from ngx_http_test_module.so and ngx_http_test2_module.so.
Syntax: _module_stub modulename
This directive can insert a module into nginx's module array in order (see conf/module_stubs for more details). Note it will change the module runtime order. This directive does not need to be used in most cases. Don't use it or edit the _conf/modulestubs file unless you know what you are doing.
It will place ngx_http_my_filter_module before ngx_http_addition_filter_module.
Syntax: _include filename
Specifies a file which contains the module stubs (via the module_stub directive).
It will load conf/module_stubs and define the loading order of the modules (via the module_stub directive).
If you want to enable a standard module after you compiled and installed tengine, you can take these steps as following.
enable the standard module you wanted in shared mode, for ### example:$ ./configure --with-http_sub_module=shared
compile it:$ make
install the shared object (*.so):$ make dso_install
It will copy the *.so files to the destination, or you can copy the files you want (in objs/modules) manually to the modules directory.
You can use the dso_tool located in the directory of nginx binary to compile a third party module.
It will compile the ngx_lua module into a shared object, and install it to the default module path. You can specify the destination directory you want install to by the --dst option.