OpenResty Stream module: unknown directive "stream" with latest OpenResty

708 views
Skip to first unread message

Badari Prasad

unread,
Mar 18, 2017, 6:11:01 AM3/18/17
to openre...@googlegroups.com

Hi,

I am new to openresty, I was trying to get a http server listening on port 80 and a tcp server listening on port 12341.

I have compiled openresty (openresty-1.11.2.2) with build option mentioned below:
./configure -j2 --with-pcre-jit 
--with-ipv6 
--with-threads 
--with-luajit 
--with-ld-opt="-Wl,-rpath,/usr/local/openresty/luajit/lib/" 
--with-stream 
--add-module=$PWD/bundle/stream-lua-nginx-module-0.0.1

While testing the nginx.conf I am getting this error
$: sudo nginx -t -c pwd/nginx.conf
nginx: [emerg] unknown directive "stream" in /usr/local/openresty/nginx/conf/nginx.conf:20
nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed

nginx.confg:
_user www-data;
worker_processes auto;
pid /run/openresty.pid;
events {
worker_connections 1024;
}
stream {
# define a TCP server listening on the port 1234:
server {
listen 12341;

    content_by_lua_block {
        ngx.say("Hello, Lua!")
    }
}

}

http {
include mime.types;
default_type application/octet-stream;

sendfile        on;
tcp_nopush      on;
tcp_nodelay     on;

keepalive_timeout  65;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

access_log /var/log/openresty/access.log;
error_log /var/log/openresty/error.log;

gzip  on;
gzip_disable "msie6";

include ../sites/default.conf;

server {
    listen 8080;
    location / {
        default_type text/html;
        content_by_lua '
            ngx.say("<p>hello, world</p>")
        ';
    }
}

}_

I am trying to terminate http on openresty and just fwd the http body to the client which connect over tcp to openresty.

I am not sure if this is version mismatch issue. Not sure if streams module works with openresty version 1.11.2.2. Can I get some help on the same?


Regards,

 Badari

Badari Prasad

unread,
Mar 18, 2017, 10:48:52 AM3/18/17
to openresty-en
And to update ./configure shows that stream lua module was configured ....

 + ngx_http_rds_csv_filter_module was configured
adding module in /home/badari/openresty-1.11.2.2/bundle/stream-lua-nginx-module-0.0.1
.....
.....
.....
checking for export symbols by default (--export-all-symbols) ... not foundchecking for SO_PASSCRED ... found
 + ngx_stream_lua_module was configured
checking for PCRE library ... found

xie cui

unread,
Mar 19, 2017, 8:35:23 AM3/19/17
to openresty-en
you need to add --with-stream to ./configure args, to enable the tcp/udp proxy_module

在 2017年3月18日星期六 UTC+8下午6:11:01,Badari Prasad写道:

Badari Prasad

unread,
Mar 21, 2017, 2:06:38 AM3/21/17
to openresty-en
Hi, the TCP stream server is up now, I am able to establish connections from tcp clients to this server. My requirement is to send the data xml body received on http request to the tcp clients which connect to stream tcp server.
Is there a way to do this ?

Ronald Vanschoren

unread,
Oct 30, 2020, 6:50:33 PM10/30/20
to openresty-en
Hey Badari,

> My requirement is to send the data xml body received on http request to the tcp clients which connect to stream tcp server.  

Did you ever get your use case up and running? If so, any pointers on how to achieve this? 

Thanks,

Ronald 
Reply all
Reply to author
Forward
0 new messages