Tengine安装lua

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Tengine安装lua相关的知识,希望对你有一定的参考价值。

[[email protected] ~]# yum -y install gcc pcre-devel openssl-devel
[[email protected] ~]# mkdir soft
[[email protected] ~]# cd soft
[[email protected] soft]# wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz
[[email protected] soft]# wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
[[email protected] soft]# tar xf tengine-2.1.2.tar.gz 
[[email protected] soft]# tar xf LuaJIT-2.0.4.tar.gz 
[[email protected] soft]# cd LuaJIT-2.0.4
[[email protected] LuaJIT-2.0.4]# make 
[[email protected] LuaJIT-2.0.4]# make install
[[email protected] LuaJIT-2.0.4]# export LUAJIT_LIB=/usr/local/lib
[[email protected] LuaJIT-2.0.4]# export LUAJIT_INC=/usr/local/include/luajit-2.0/
[[email protected] LuaJIT-2.0.4]# echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
[[email protected] LuaJIT-2.0.4]# ldconfig
[[email protected] LuaJIT-2.0.4]# cd ..
[[email protected] soft]# cd tengine-2.1.2
[[email protected] 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"
[[email protected] tengine-2.1.2]# make 
[[email protected] tengine-2.1.2]# make install
[[email protected] tengine-2.1.2]# /usr/local/nginx/sbin/nginx 
[[email protected] tengine-2.1.2]# netstat -tulnpan |grep nginx
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      8792/nginx   
[[email protected] 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
[[email protected] tengine-2.1.2]# cd /usr/local/nginx/conf/
[[email protected] conf]# vim nginx.conf
location /lua {
# MIME type determined by default_type:
default_type ‘text/plain‘;
content_by_lua "ngx.say(‘Hello World Lua!‘)";
}
[[email protected] 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
[[email protected] conf]# /usr/local/nginx/sbin/nginx -s reload
[[email protected] conf]# curl   http://127.0.0.1/lua
Hello World Lua!

换个机器来测试 


[[email protected] ~]# curl http://192.168.2.1/lua
Hello World Lua!


本文出自 “devops” 博客,谢绝转载!

以上是关于Tengine安装lua的主要内容,如果未能解决你的问题,请参考以下文章

Tengine 安装

tengine安装问题

centos 6.5 x64安装Tengine

编译安装Tengine

Nginx安装-Tengine(阿里baba的)

tengine安装,haproxy访问不同路径对接不同集群