Skip to content

Commit bad5677

Browse files
hnakamuragentzh
authored andcommitted
feature: this module can now be built as a "dynamic module" with NGINX 1.9.11+ via the --add-dynamic-module=PATH option of ./configure. thanks Hiroaki Nakamura for the original patch in openresty#43.
Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
1 parent cfd24d3 commit bad5677

File tree

2 files changed

+48
-12
lines changed

2 files changed

+48
-12
lines changed

README.markdown

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,18 +1005,26 @@ Alternatively, you can build Nginx with this module all by yourself:
10051005
* and then apply the patch to your nginx source tree that fixes an important bug in the mainline Nginx core: <https://raw.github.com/openresty/openresty/master/patches/nginx-1.4.3-upstream_truncation.patch> (you do NOT need this patch if you are using nginx 1.5.3 and later versions.)
10061006
* after that, download the latest version of the release tarball of this module from srcache-nginx-module [file list](https://github.com/openresty/srcache-nginx-module/tags),
10071007
* and finally build the Nginx source with this module
1008-
```nginx
10091008

1010-
wget 'http://nginx.org/download/nginx-1.9.7.tar.gz'
1011-
tar -xzvf nginx-1.9.7.tar.gz
1012-
cd nginx-1.9.7/
1009+
```bash
1010+
wget 'http://nginx.org/download/nginx-1.9.7.tar.gz'
1011+
tar -xzvf nginx-1.9.7.tar.gz
1012+
cd nginx-1.9.7/
1013+
1014+
# Here we assume you would install you nginx under /opt/nginx/.
1015+
./configure --prefix=/opt/nginx \
1016+
--add-module=/path/to/srcache-nginx-module
10131017

1014-
# Here we assume you would install you nginx under /opt/nginx/.
1015-
./configure --prefix=/opt/nginx \
1016-
--add-module=/path/to/srcache-nginx-module
1018+
make -j2
1019+
make install
1020+
```
1021+
1022+
Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the
1023+
`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module)
1024+
directive, for example,
10171025

1018-
make -j2
1019-
make install
1026+
```nginx
1027+
load_module /path/to/modules/ngx_http_srcache_filter_module.so;
10201028
```
10211029

10221030
[Back to TOC](#table-of-contents)

config

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
ngx_addon_name=ngx_http_srcache_filter_module
2-
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_srcache_filter_module"
3-
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_srcache_filter_module.c $ngx_addon_dir/src/ngx_http_srcache_util.c $ngx_addon_dir/src/ngx_http_srcache_var.c $ngx_addon_dir/src/ngx_http_srcache_store.c $ngx_addon_dir/src/ngx_http_srcache_fetch.c $ngx_addon_dir/src/ngx_http_srcache_headers.c"
4-
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ddebug.h $ngx_addon_dir/src/ngx_http_srcache_filter_module.h $ngx_addon_dir/src/ngx_http_srcache_util.h $ngx_addon_dir/src/ngx_http_srcache_var.h $ngx_addon_dir/src/ngx_http_srcache_fetch.h $ngx_addon_dir/src/ngx_http_srcache_store.h $ngx_addon_dir/src/ngx_http_srcache_headers.h"
52

3+
HTTP_SRCACHE_FILTER_SRCS=" \
4+
$ngx_addon_dir/src/ngx_http_srcache_filter_module.c \
5+
$ngx_addon_dir/src/ngx_http_srcache_util.c \
6+
$ngx_addon_dir/src/ngx_http_srcache_var.c \
7+
$ngx_addon_dir/src/ngx_http_srcache_store.c \
8+
$ngx_addon_dir/src/ngx_http_srcache_fetch.c \
9+
$ngx_addon_dir/src/ngx_http_srcache_headers.c \
10+
"
11+
12+
HTTP_SRCACHE_FILTER_DEPS=" \
13+
$ngx_addon_dir/src/ddebug.h \
14+
$ngx_addon_dir/src/ngx_http_srcache_filter_module.h \
15+
$ngx_addon_dir/src/ngx_http_srcache_util.h \
16+
$ngx_addon_dir/src/ngx_http_srcache_var.h \
17+
$ngx_addon_dir/src/ngx_http_srcache_fetch.h \
18+
$ngx_addon_dir/src/ngx_http_srcache_store.h \
19+
$ngx_addon_dir/src/ngx_http_srcache_headers.h \
20+
"
21+
22+
if [ -n "$ngx_module_link" ]; then
23+
ngx_module_type=HTTP_AUX_FILTER
24+
ngx_module_name=$ngx_addon_name
25+
ngx_module_srcs="$HTTP_SRCACHE_FILTER_SRCS"
26+
ngx_module_deps="$HTTP_SRCACHE_FILTER_DEPS"
27+
28+
. auto/module
29+
else
30+
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name"
31+
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HTTP_SRCACHE_FILTER_SRCS"
32+
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HTTP_SRCACHE_FILTER_DEPS"
33+
fi

0 commit comments

Comments
 (0)