Description
Example
worker_processes  1;

dso {
     load ngx_http_lua_module.so;
     load ngx_http_memcached_module.so;
}

events {
   worker_connections  1024;
}
Directives


Syntax: path path

Default: NGX_PREFIX/modules

Context: dso

This directive specifies the default path (prefix) of DSO modules.

Example:

path /home/dso/module;

Sets the default path to /home/dso/module.



Syntax: load [module_name] [module_path]

Default: none

Context: dso

The load directive loads the shared object file and enables the module. module_name is the name of the DSO module, and module_path is the path of the DSO module.

The order in which the module is searched is as follows:

Example:

load ngx_http_empty_gif_module  ngx_http_empty_gif_module.so;
load ngx_http_test_module;
load ngx_http_test2_module.so;

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 module_name

Default: none

Context: dso

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/module_stubs file unless you know what you are doing.

Example:

    module_stub ngx_core_module;
    module_stub ngx_errlog_module;
    module_stub ngx_conf_module;
    module_stub ngx_events_module;
    module_stub ngx_event_core_module;
    module_stub ngx_epoll_module;
    module_stub ngx_openssl_module;
    module_stub ngx_http_module;
    module_stub ngx_http_core_module;
    .......................
    module_stub ngx_http_addition_filter_module;
    module_stub ngx_http_my_filter_module;

It will place ngx_http_my_filter_module before ngx_http_addition_filter_module.



Syntax: include file_name

Default: none

Context: dso

Specifies a file which contains the module stubs (via the module_stub directive).

Example:

include module_stubs;

It will load conf/module_stubs and define the loading order of the modules (via the module_stub directive).

How to compile a module


If you want to enable a standard module after you compiled and installed tengine, you can take these steps as following.

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.

Example:

./dso_tool --add-module=/home/dso/lua-nginx-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.