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

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

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

cd /usr/local/openrestygithub

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

2.添加环境变量:tcp

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

3.编译stream-lua-nginx-modulelua

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

tar -zxvf  ngx_openresty-1.9.7.4.tar.gzserver

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已经建立成功啦!

相关文章
相关标签/搜索