Tengine安装lua

[root@centos-01 ~]# yum -y install gcc pcre-devel openssl-devel
[root@centos-01 ~]# mkdir soft
[root@centos-01 ~]# cd soft
[root@centos-01 soft]# wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
[root@centos-01 soft]# wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
[root@centos-01 soft]# tar xf tengine-2.1.2.tar.gz 
[root@centos-01 soft]# tar xf LuaJIT-2.0.4.tar.gz 
[root@centos-01 soft]# cd LuaJIT-2.0.4
[root@centos-01 LuaJIT-2.0.4]# make 
[root@centos-01 LuaJIT-2.0.4]# make install
[root@centos-01 LuaJIT-2.0.4]# export LUAJIT_LIB=/usr/local/lib
[root@centos-01 LuaJIT-2.0.4]# export LUAJIT_INC=/usr/local/include/luajit-2.0/
[root@centos-01 LuaJIT-2.0.4]# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
[root@centos-01 LuaJIT-2.0.4]# ldconfig
[root@centos-01 LuaJIT-2.0.4]# cd ..
[root@centos-01 soft]# cd tengine-2.1.2
[root@centos-01 tengine-2.1.2]# ./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_concat_module --with-http_lua_module --with-ld-opt="-Wl,-rpath,$LUAJIT_LIB"
[root@centos-01 tengine-2.1.2]# make 
[root@centos-01 tengine-2.1.2]# make install
[root@centos-01 tengine-2.1.2]# /usr/local/nginx/sbin/nginx 
[root@centos-01 tengine-2.1.2]# netstat -tulnpan |grep nginx
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      8792/nginx   
[root@centos-01 tengine-2.1.2]# curl -I  127.0.0.1
HTTP/1.1 200 OK
Server: Tengine/2.1.2
Date: Tue, 15 Nov 2016 06:38:30 GMT
Content-Type: text/html
Content-Length: 555
Last-Modified: Tue, 15 Nov 2016 06:37:47 GMT
Connection: keep-alive
ETag: "582aad3b-22b"
Accept-Ranges: bytes
[root@centos-01 tengine-2.1.2]# cd /usr/local/nginx/conf/
[root@centos-01 conf]# vim nginx.conf
location /lua {
# MIME type determined by default_type:
default_type 'text/plain';
content_by_lua "ngx.say('Hello World Lua!')";
}
[root@centos-01 conf]# /usr/local/nginx/sbin/nginx -t
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@centos-01 conf]# /usr/local/nginx/sbin/nginx -s reload
[root@centos-01 conf]# curl   http://127.0.0.1/lua
Hello World Lua!

换个机器来测试 


[root@centos-02 ~]# curl http://192.168.2.1/lua
Hello World Lua!
-----------------------------------
©著作权归作者所有:来自51CTO博客作者devops_的原创作品,谢绝转载,否则将追究法律责任
Tengine安装lua
https://blog.51cto.com/nowsafe/1873034

Last updated