Skip to content

Commit

Permalink
Merge pull request #7 from yourpleasure/master
Browse files Browse the repository at this point in the history
build ngx kafka module as dynamic module
  • Loading branch information
brg-liuwei authored Sep 12, 2016
2 parents 4216cdb + 89c0119 commit cd133b7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
15 changes: 11 additions & 4 deletions config
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cd133b7

Please sign in to comment.