diff --git a/README.md b/README.md index e7ea4ef..6413879 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,16 @@ Compile this module into nginx sudo make install # or, use `sudo make upgrade` instead of `sudo make install` +In newer version of nginx(>=1.9.11), you can make this module as an dynamic module. + + git clone https://github.com/brg-liuwei/ngx_kafka_module + + # cd /path/to/nginx + ./configure --add-dynamic-module=/path/to/ngx_kafka_module + + make modules + # This will generate a objs/ngx_http_kafka_module.so in your /path/to/ngx_kafka_module and you can copy the so file to a proper location. + [Back to TOC](#table-of-contents) Nginx Configuration @@ -77,6 +87,12 @@ Add the code to nginx conf file as follows } } +If you compile module as a dynamic module, you must add + + load_module /path/to/ngx_http_kafka_module.so; + +at the beginning of the nginx config file besides adding the code. After that you can use the module by just executing `nginx -c /path/to/nginx.conf -s reload`. + [Back to TOC](#table-of-contents) diff --git a/config b/config index 46ff166..0c98a09 100644 --- a/config +++ b/config @@ -1,5 +1,12 @@ ngx_addon_name=ngx_http_kafka_module -HTTP_MODULES="$HTTP_MODULES ngx_http_kafka_module" -NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_kafka_module.c" - -CORE_LIBS="$CORE_LIBS -lrdkafka -lz -lpthread" +if test -n "$ngx_module_link"; then + ngx_module_type=HTTP + ngx_module_name=$ngx_addon_name + ngx_module_srcs="$ngx_addon_dir/ngx_http_kafka_module.c" + ngx_module_libs="-lrdkafka -lz -lpthread" + . auto/module +else + HTTP_MODULES="$HTTP_MODULES ngx_http_kafka_module" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_kafka_module.c" + CORE_LIBS="$CORE_LIBS -lrdkafka -lz -lpthread" +fi