content_by_lua 容量大小有限制?

632 views
Skip to first unread message

Bill Zhu

unread,
Jan 8, 2013, 10:48:34 AM1/8/13
to open...@googlegroups.com
出现了 nginx: [emerg] too long parameter, probably missing terminating "'" character
我在测试 redis-storage 时出现的, conf:

    https://gist.github.com/0a636177c892047dab47

如果移除最后一个 local 内容则ok

ngx_openresty-1.2.6.1

agentzh

unread,
Jan 8, 2013, 2:06:07 PM1/8/13
to open...@googlegroups.com
Hello!

2013/1/8 Bill Zhu:


> 出现了 nginx: [emerg] too long parameter, probably missing terminating "'"
> character
> 我在测试 redis-storage 时出现的, conf:
>
> https://gist.github.com/0a636177c892047dab47
>
> 如果移除最后一个 local 内容则ok
>

Nginx 的配置文件对于配置指令的参数长度有大约 4k 的限制,你这里的 content_by_lua 指令的参数长度已超过了此限制,所以会报这个错误。

建议把较长的 Lua 代码放入外部独立的 .lua 文件中,然后通过 content_by_lua_file 配置指令引用之:

http://wiki.nginx.org/HttpLuaModule#content_by_lua_file

Best regards,
-agentzh

Bill Zhu

unread,
Jan 8, 2013, 8:31:45 PM1/8/13
to open...@googlegroups.com
感谢。
请问除了content_by_lua_file 外,能否扩大这个4k 的限制,这个参数在哪个源码文件?

agentzh

unread,
Jan 8, 2013, 8:34:11 PM1/8/13
to open...@googlegroups.com
Hello!

2013/1/8 Bill Zhu:


> 感谢。
> 请问除了content_by_lua_file 外,能否扩大这个4k 的限制,这个参数在哪个源码文件?
>

这个参数长度的限制是写死在 Nginx 核心中的,即宏 NGX_CONF_BUFFER,其定义在 src/core/ngx_conf_file.c 文件中。

Best regards,
-agentzh

Bill Zhu

unread,
Jan 8, 2013, 8:49:59 PM1/8/13
to open...@googlegroups.com
谢谢,我patch、重编译下看看,是否可行,:)
Reply all
Reply to author
Forward
0 new messages