标签:style blog http java color 使用
Lua是一种跟JavaScript很像的语言,Ngix_Lua同样使用异步单线程,语法甚至比JS更加简单,之前的评测指出,Ngix_lua的性能几乎是Node.JS的一倍。
Nginx 特点
1.流行的高性能HTTP服务器
2.事件驱动(异步)架构
3.少量且可测内存占用
4.声明性配置语言
5.基于C的可扩展模块
通过lua-nginx-module即可在nginx上启动lua脚本。
一个例子:
location / {
    content_by_lua ‘
        local res = ngx.location.capture("/sub")
        if res.status >= 500 then 
            ngx.exit(res.status) 
        end
        ngx.status = res.status
        ngx.say(res.body)
    ‘;
}
location /sub {
    echo "Hello, Sub-Request!";
}
nginx使用lua脚本的方法,布布扣,bubuko.com
标签:style blog http java color 使用
原文地址:http://www.cnblogs.com/yes123/p/3852728.html