美文网首页
2018-12-29 OpenResty 用 Lua 语言实现简

2018-12-29 OpenResty 用 Lua 语言实现简

作者: 张大志的博客 | 来源:发表于2018-12-29 14:04 被阅读0次

1、下载openresty的源码包

下载地址:http://openresty.org/cn/download.html

2、编译安装openresty

tar -xvf openresty-1.13.6.2.tar.gz
cd openresty-1.13.6.2/
./configure --prefix=/data/openresty
gmake&&gmake install
/data/openresty/nginx/sbin/nginx   #启动服务

3、修改配置文件

vim nginx.conf
 location /lua {
            default_type text/html;
            content_by_lua 'ngx.say("User-Agent: ", ngx.req.get_headers()["User-Agent"])';  #当访问的uri为lua时就用lua代码去执行,返回给客户端浏览器的类型
        }
/data/openresty/nginx/sbin/nginx -s reload

相关文章

网友评论

      本文标题:2018-12-29 OpenResty 用 Lua 语言实现简

      本文链接:https://www.haomeiwen.com/subject/neyulqtx.html