Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build ngx kafka module as dynamic module #7

Merged
merged 2 commits into from
Sep 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,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 @@ -75,6 +85,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