openresty编译添加stream-lua-nginx-module模块

1.下载stream-lua-nginx-module模块:

(https://github.com/openresty/stream-lua-nginx-module#installation)github地址

cd /usr/local/openresty

命令:git clone https://github.com/openresty/stream-lua-nginx-module.git

2.添加环境变量:

 export LUAJIT_LIB=/usr/local/openresty/luajit/lib
 export LUAJIT_INC=/usr/local/openresty/luajit/include/luajit-2.1

3.编译stream-lua-nginx-module

wget  http://openresty.org/download/ngx_openresty-1.9.7.4.tar.gz

tar -zxvf  ngx_openresty-1.9.7.4.tar.gz

cd ngx_openresty-1.9.7.4

输入nginx -V命令,将参数添加上来即可

./configure --prefix=/usr/local/openresty --with-cc-opt='-O2 -I/usr/local/Cellar/openssl/1.0.2h_1/include/ -I/usr/local/Cellar/pcre/8.39/include/'  --with-stream --with-stream_ssl_module --add-module=/usr/local/openresty/stream-lua-nginx-module --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/Cellar/openssl/1.0.2h_1/lib/ -L/usr/local/Cellar/pcre/8.39/lib/' --with-http_ssl_module

make

make install

编译安装完后查看nginx参数:

请看图片最后!!!,此时表明已经安装成功

4.学习stream模块:

在nginx.conf文件中加上红色框框内代码,即可构建一个tcp server,端口号为1234

5.连接socket tcp服务端:

法一:通过telnet方法验证

法二:通过socket 连接来验证:

此时表明stream的tcp server已经创建成功啦!

 

 

 

转载于:https://my.oschina.net/u/2263272/blog/808368

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值