yaoweibin / nginx_upstream_check_module

Health checks upstreams for nginx
http://github.com/yaoweibin/nginx_upstream_check_module
2.06k stars 484 forks source link

Make dynamically loadable module #234

Open tsgan opened 4 years ago

tsgan commented 4 years ago

Is it possible to make upstream check module as dynamically loadable module that works with nginx-1.18.x?

thanks,

malza321 commented 3 years ago

hi! did you make it?

I have the same issue with you..

tsgan commented 3 years ago

no, it doesn't work as dynamic module

malza321 commented 3 years ago

no, it doesn't work as dynamic module

omg :(

0xDones commented 1 year ago

@tsgan @malza321 I was able to compile it as a dynamic module by updating this module's config file with the content from this comment.

nginx_upstream_check_module/config

ngx_feature="ngx_http_upstream_check_module"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path="$ngx_addon_dir"
ngx_feature_deps="$ngx_addon_dir/ngx_http_upstream_check_module.h"
ngx_check_src="$ngx_addon_dir/ngx_http_upstream_check_module.c"
ngx_feature_test="int a;"
. auto/feature

ngx_addon_name=ngx_http_upstream_check_module
ngx_module_incs=$ngx_addon_dir

if test -n "$ngx_module_link"; then
    ngx_module_type="HTTP"
    ngx_module_name="ngx_http_upstream_check_module"
    ngx_module_srcs="$ngx_addon_dir/ngx_http_upstream_check_module.c"
    ngx_module_deps="$ngx_addon_dir/ngx_http_upstream_check_module.h"

    . auto/module
else
    have=NGX_HTTP_UPSTREAM_CHECK . auto/have
    HTTP_MODULES="$HTTP_MODULES ngx_http_upstream_check_module"
    NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_feature_deps"
    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_check_src"
    CORE_INCS="$CORE_INCS $ngx_feature_path"
fi

Building module

cd <nginx source code dir>
./configure --with-compat --add-dynamic-module="<path>/nginx_upstream_check_module"
make modules
ls -la objs