Skip to content

Commit f49a4ca

Browse files
committed
doc: readme: aligned with ngx_http_lua's README and removed mentions of PUC-Rio Lua.
1 parent b404b07 commit f49a4ca

File tree

1 file changed

+66
-35
lines changed

1 file changed

+66
-35
lines changed

README.md

+66-35
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ Name
44

55
ngx_stream_lua_module - Embed the power of Lua into Nginx stream/TCP Servers.
66

7-
This module is a core component of OpenResty. If you are using this module, then you are essentially using OpenResty :)
7+
This module is a core component of OpenResty. If you are using this module,
8+
then you are essentially using OpenResty.
89

9-
*This module is not distributed with the Nginx source.* See [the installation instructions](#installation).
10+
*This module is not distributed with the Nginx source.* See [the installation
11+
instructions](#installation).
1012

1113
Table of Contents
1214
=================
1315

1416
* [Name](#name)
1517
* [Status](#status)
18+
* [Version](#version)
1619
* [Synopsis](#synopsis)
1720
* [Description](#description)
1821
* [Directives](#directives)
@@ -34,6 +37,13 @@ Status
3437

3538
Production ready.
3639

40+
Version
41+
=======
42+
43+
This document describes ngx_stream_lua
44+
[v0.0.8](https://github.com/openresty/stream-lua-nginx-module/tags), which is not
45+
released yet.
46+
3747
Synopsis
3848
========
3949

@@ -99,23 +109,26 @@ stream {
99109
}
100110
```
101111

112+
[Back to TOC](#table-of-contents)
113+
102114
Description
103115
===========
104116

105-
This module is a core component of OpenResty. If you are using this module, then you are essentially using OpenResty :)
117+
This is a port of the
118+
[ngx_http_lua_module](https://github.com/openresty/lua-nginx-module#readme) to
119+
the Nginx "stream" subsystem so as to support generic stream/TCP clients.
106120

107-
This is a port of the [ngx_http_lua_module](https://github.com/openresty/lua-nginx-module#readme) to the NGINX "stream" subsystem so
108-
as to support generic stream/TCP clients in the downstream.
109-
110-
Lua APIs and directive names remain the same as the `ngx_http_lua_module`.
121+
The available Lua APIs and Nginx directives remain the same as those of the
122+
ngx_http_lua module.
111123

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

114126
Directives
115127
----------
116128

117-
The following directives are ported directly from `ngx_http_lua_module`. Please check the
118-
documentation of `ngx_http_lua_module` for more details about their usage and behavior.
129+
The following directives are ported directly from ngx_http_lua. Please check
130+
the documentation of ngx_http_lua for more details about their usage and
131+
behavior.
119132

120133
* [lua_load_resty_core](https://github.com/openresty/lua-nginx-module#lua_load_resty_core)
121134
* [lua_code_cache](https://github.com/openresty/lua-nginx-module#lua_code_cache)
@@ -155,11 +168,14 @@ documentation of `ngx_http_lua_module` for more details about their usage and be
155168
* [lua_capture_error_log](https://github.com/openresty/lua-nginx-module#lua_capture_error_log)
156169
* [preread_by_lua_no_postpone](#preread_by_lua_no_postpone)
157170

158-
The [send_timeout](http://nginx.org/r/send_timeout) directive in the Nginx "http" subsystem is missing in the "stream" subsystem.
159-
So `ngx_stream_lua_module` uses the `lua_socket_send_timeout` for this purpose.
171+
The [send_timeout](https://nginx.org/r/send_timeout) directive in the Nginx
172+
"http" subsystem is missing in the "stream" subsystem. As such,
173+
ngx_stream_lua_module uses the `lua_socket_send_timeout` directive for this
174+
purpose instead.
160175

161-
**Note:** the lingering close directive that used to exist in older version of stream_lua_nginx_module has been removed and can
162-
now be simulated with the newly added [tcpsock:shutdown](#tcpsockshutdown) method if necessary.
176+
**Note:** the lingering close directive that used to exist in older version of
177+
`stream_lua_nginx_module` has been removed and can now be simulated with the
178+
newly added [tcpsock:shutdown](#tcpsockshutdown) API if necessary.
163179

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

@@ -256,7 +272,7 @@ lua_add_variable
256272

257273
**context:** *stream*
258274

259-
Add the variable `$var` to the stream subsystem and makes it changeable. If `$var` already exists,
275+
Add the variable `$var` to the "stream" subsystem and makes it changeable. If `$var` already exists,
260276
this directive will do nothing.
261277

262278
By default, variables added using this directive are considered "not found" and reading them
@@ -284,12 +300,12 @@ This directive was first introduced in the `v0.0.4` release.
284300
Nginx API for Lua
285301
-----------------
286302

287-
Many Lua API functions are ported from the `ngx_http_lua_module`. Check out the official manual of
288-
`ngx_http_lua_module` for more details on these Lua API functions.
303+
Many Lua API functions are ported from ngx_http_lua. Check out the official
304+
manual of ngx_http_lua for more details on these Lua API functions.
289305

290306
* [ngx.var.VARIABLE](https://github.com/openresty/lua-nginx-module#ngxvarvariable)
291307

292-
This module fully supports the new variable subsystem inside the NGINX stream core. You may access any
308+
This module fully supports the new variable subsystem inside the Nginx stream core. You may access any
293309
[built-in variables](https://nginx.org/en/docs/stream/ngx_stream_core_module.html#variables) provided by the stream core or
294310
other stream modules.
295311
* [Core constants](https://github.com/openresty/lua-nginx-module#core-constants)
@@ -304,7 +320,7 @@ other stream modules.
304320
* [ngx.balancer](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md)
305321

306322
Only raw request sockets are supported, for obvious reasons. The `raw` argument value
307-
is ignored and the raw request socket is always returned. Unlike `ngx_http_lua_module`,
323+
is ignored and the raw request socket is always returned. Unlike ngx_http_lua,
308324
you can still call output API functions like `ngx.say`, `ngx.print`, and `ngx.flush`
309325
after acquiring the raw request socket via this function.
310326

@@ -316,6 +332,8 @@ packets back to the client using the downstream socket.
316332

317333
The raw TCP sockets returned by this module will contain the following extra method:
318334

335+
[Back to TOC](#directives)
336+
319337
tcpsock:shutdown
320338
----------------
321339

@@ -494,9 +512,7 @@ TODO
494512
====
495513

496514
* Add new directives `access_by_lua_block` and `access_by_lua_file`.
497-
* Add `ngx.semaphore` API.
498-
* Add support for [lua-resty-core](https://github.com/openresty/lua-resty-core).
499-
* Add `lua_postpone_output` to emulate the [postpone_output](http://nginx.org/r/postpone_output) directive.
515+
* Add `lua_postpone_output` to emulate the [postpone_output](https://nginx.org/r/postpone_output) directive.
500516

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

@@ -509,34 +525,45 @@ The latest version of this module is compatible with the following versions of N
509525
* 1.15.x (last tested: 1.15.8)
510526
* 1.13.x (last tested: 1.13.6)
511527

512-
Nginx cores older than 1.13.6 (exclusive) are *not* tested and may or may not work. Use at your own risk!
528+
Nginx cores older than 1.13.6 (exclusive) are *not* tested and may or may not
529+
work. Use at your own risk!
513530

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

516533
Installation
517534
============
518535

519-
This module can be manually compiled into Nginx or OpenResty:
536+
It is *highly* recommended to use [OpenResty releases](https://openresty.org)
537+
which bundle Nginx, ngx_http_lua, ngx_stream_lua, (this module), LuaJIT, as
538+
well as other powerful companion Nginx modules and Lua libraries.
520539

521-
1. Install LuaJIT 2.1 or Lua 5.1 (Lua 5.2+ are *not* supported yet). LuaJIT can be downloaded from the [the LuaJIT project website](http://luajit.org/download.html) and Lua 5.1, from the [Lua project website](http://www.lua.org/). Some distribution package managers also distribute LuaJIT and/or Lua.
522-
1. Download the latest version of ngx_stream_lua [HERE](https://github.com/openresty/stream-lua-nginx-module/tags).
523-
1. Download the latest supported version of NGINX [HERE](http://nginx.org/) (See [Nginx Compatibility](#nginx-compatibility)) or the OpenResty bundle from [HERE](https://openresty.org/).
540+
It is discouraged to build this module with Nginx yourself since it is tricky
541+
to set up exactly right.
524542

525-
Build the source of NGINX or OpenResty with this module, like below:
543+
Note that Nginx, LuaJIT, and OpenSSL official releases have various limitations
544+
and long standing bugs that can cause some of this module's features to be
545+
disabled, not work properly, or run slower. Official OpenResty releases are
546+
recommended because they bundle [OpenResty's optimized LuaJIT 2.1 fork](https://github.com/openresty/luajit2) and
547+
[Nginx/OpenSSL
548+
patches](https://github.com/openresty/openresty/tree/master/patches).
549+
550+
Alternatively, ngx_stream_lua can be manually compiled into Nginx:
551+
552+
1. LuaJIT can be downloaded from the [latest release of OpenResty's LuaJIT fork](https://github.com/openresty/luajit2/releases). The official LuaJIT 2.x releases are also supported, although performance will be significantly lower for reasons elaborated above
553+
1. Download the latest version of ngx_stream_lua [HERE](https://github.com/openresty/stream-lua-nginx-module/tags)
554+
1. Download the latest supported version of Nginx [HERE](https://nginx.org/) (See [Nginx Compatibility](#nginx-compatibility))
555+
556+
Build the source with this module:
526557

527558
```bash
528-
wget 'http://nginx.org/download/nginx-1.13.6.tar.gz'
559+
wget 'https://nginx.org/download/nginx-1.13.6.tar.gz'
529560
tar -xzvf nginx-1.13.6.tar.gz
530561
cd nginx-1.13.6/
531562

532563
# tell nginx's build system where to find LuaJIT 2.1:
533564
export LUAJIT_LIB=/path/to/luajit/lib
534565
export LUAJIT_INC=/path/to/luajit/include/luajit-2.1
535566

536-
# or tell where to find Lua if using Lua instead:
537-
#export LUA_LIB=/path/to/lua/lib
538-
#export LUA_INC=/path/to/lua/include
539-
540567
# Here we assume Nginx is to be installed under /opt/nginx/.
541568
./configure --prefix=/opt/nginx \
542569
--with-ld-opt="-Wl,-rpath,/path/to/luajit-or-lua/lib" \
@@ -549,8 +576,9 @@ make -j4
549576
make install
550577
```
551578

552-
You may use `--without-http` if you do not wish to use this module with the HTTP subsystem.
553-
ngx_stream_lua will work perfectly fine without the presense of the HTTP subsystem.
579+
You may use `--without-http` if you do not wish to use this module with the
580+
"http" subsystem. ngx_stream_lua will work perfectly fine without the "http"
581+
subsystem.
554582

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

@@ -576,7 +604,8 @@ The [openresty](https://groups.google.com/group/openresty) mailing list is for C
576604
Code Repository
577605
===============
578606

579-
The code repository of this project is hosted on github at [openresty/stream-lua-nginx-module](https://github.com/openresty/stream-lua-nginx-module).
607+
The code repository of this project is hosted on GitHub at
608+
[openresty/stream-lua-nginx-module](https://github.com/openresty/stream-lua-nginx-module).
580609

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

@@ -601,6 +630,8 @@ to make code sharing between this module and [lua-nginx-module](https://github.c
601630
* `balancer_by_lua_*`, `preread_by_lua_*`, `log_by_lua_*` and `ssl_certby_lua*` phases support.
602631
* [`reqsock:peek`](#reqsockpeek) API support.
603632

633+
[Back to TOC](#table-of-contents)
634+
604635
Copyright and License
605636
=====================
606637

0 commit comments

Comments
 (0)