Skip to content

Commit 71917f3

Browse files
committed
update nginx 1.9.7, using stream
1 parent 8a21402 commit 71917f3

File tree

4 files changed

+51
-4
lines changed

4 files changed

+51
-4
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@
1919
[submodule "headers-more-nginx-module"]
2020
path = headers-more-nginx-module
2121
url = https://github.com/openresty/headers-more-nginx-module.git
22+
[submodule "stream-lua-nginx-module"]
23+
path = stream-lua-nginx-module
24+
url = https://github.com/openresty/stream-lua-nginx-module.git

conf/stream.conf.1001

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
user root;
2+
worker_processes 1;
3+
daemon off;
4+
error_log stderr info;
5+
6+
pid /var/run/nginx.pid;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
stream {
13+
lua_check_client_abort on;
14+
# define a TCP server listening on the port 1234:
15+
server {
16+
listen 1234;
17+
18+
content_by_lua_block {
19+
local function my_cleanup()
20+
-- custom cleanup work goes here, like cancelling a pending DB transaction
21+
22+
-- now abort all the "light threads" running in the current request handler
23+
ngx.exit(499)
24+
end
25+
26+
local ok, err = ngx.on_abort(my_cleanup)
27+
if not ok then
28+
ngx.log(ngx.ERR, "failed to register the on_abort callback: ", err)
29+
ngx.exit(500)
30+
end
31+
while true do
32+
ngx.sleep(1)
33+
ngx.say("Hello, Lua!" .. ngx.time())
34+
end
35+
}
36+
}
37+
}

script/build.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ usage()
2323
buildNgx()
2424
{
2525
cd $NGINX
26-
export LUAJIT_INC=/usr/local/luajit-2.0.1/include/luajit-2.0/
27-
export LUAJIT_LIB=/usr/local/luajit-2.0.1/lib/
28-
./configure --prefix=/nginx \
26+
export LUAJIT_INC=/usr/local/include/luajit-2.1/
27+
export LUAJIT_LIB=/usr/local/lib
28+
./auto/configure --prefix=/nginx \
2929
--with-http_ssl_module \
3030
--without-http_fastcgi_module \
3131
--without-http_uwsgi_module \
@@ -40,11 +40,15 @@ buildNgx()
4040
--without-mail_imap_module \
4141
--without-mail_smtp_module \
4242
--with-pcre \
43+
--with-pcre \
44+
--with-stream \
45+
--with-stream_ssl_module \
4346
--add-module=../ngx_devl_kit \
4447
--add-module=../lua-nginx-module \
4548
--add-module=../ngx_http_dyups_module \
4649
--add-module=../lua-upstream-cache-nginx-module \
4750
--add-module=../headers-more-nginx-module \
51+
--add-module=../stream-lua-nginx-module \
4852
--add-module=../ngx_http_process_coredump \
4953
--with-debug \
5054
--with-cc-opt="-O0"
@@ -59,7 +63,7 @@ buildReleaseNgx()
5963
cd $NGINX
6064
export LUAJIT_INC=/usr/local/include/luajit-2.1/
6165
export LUAJIT_LIB=/usr/local/lib
62-
./configure --prefix=/nginx \
66+
./auto/configure --prefix=/nginx \
6367
--with-http_ssl_module \
6468
--without-http_fastcgi_module \
6569
--without-http_uwsgi_module \
@@ -74,6 +78,8 @@ buildReleaseNgx()
7478
--without-mail_imap_module \
7579
--without-mail_smtp_module \
7680
--with-pcre \
81+
--with-stream \
82+
--with-stream_ssl_module \
7783
--add-module=../ngx_devl_kit \
7884
--add-module=../lua-nginx-module \
7985
--add-module=../ngx_http_dyups_module \

stream-lua-nginx-module

Submodule stream-lua-nginx-module added at 8693f64

0 commit comments

Comments
 (0)