nginx access_by_lua:如何使用两次

时间:2014-11-12 08:43:25

标签: nginx lua

access_by_lua '
    ngx.log(ngx.NOTICE, "Global access! Host: <" .. ngx.var.server_name .. ">");
';

log_by_lua '
    ngx.log(ngx.NOTICE, "End of request. Host: <" .. ngx.var.server_name .. ">");
';

server {
    listen       127.0.0.1:8890;
    server_name  localhost;

    access_log  /tmp/local.access.log  upstreamlog;

    location /highload {

        access_by_lua '
            ngx.log(ngx.NOTICE, "Location access! Host: <" .. ngx.var.server_name .. ">");
        ';
        echo Hello;
    }
}

在这个配置文件中,我想查看&#34; Global&#34;的日志输出。并为&#34;位置&#34;。但它仅针对&#34;位置&#34;触发。任何人都可以帮助或描述它的工作原理吗?

0 个答案:

没有答案