hi,
添加`proxy_temp_path`, 在使用`init_worker_by_lua`的情况下发生错误, 如下:
2014/08/14 17:32:32 [emerg] 78321#0: the path name "/usr/local/nginx/proxy_temp" in /usr/local/nginx/conf/nginx.conf:11 has the same name as default path, but the different levels, you need to define default path in http section
这个错误的配置如下:
daemon off;
master_process off;
#worker_processes 2;
events {
worker_connections 8000;
}
http {
proxy_temp_path /usr/local/nginx/proxy_temp;
init_worker_by_lua '
local a = 2 + 3
';
server {
listen 8080;
location / {
content_by_lua ' ngx.say("hello") ';
}
}
}
如果去掉`init_worker_by_lua`就能工作正常, 我看了下代码, 可能是在调用`ngx_http_proxy_merge_loc_conf`的时候(在init_worker_by_lua阶段), `ngx_add_path`发生了值重复? (看不懂 :)).
这是测试nginx的编译配置. 请注意`proxy_temp_path`必须和编译时的--http-proxy-temp-path一致.
我觉得这可能是我的使用错误, 但是确实是因为init_worker_by_lua调用了`ngx_http_proxy_merge_loc_conf`之后才会发生. :)
nginx version: nginx/1.7.3
built by clang 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configure arguments: --prefix=/usr/local/nginx --with-debug --with-http_stub_status_module --add-module=../git/lua-nginx-module --add-module=../git/lua-upstream-nginx-module
=========================== LLDB output ================================
(lldb) bt
* thread #1: tid = 0x13dc7a, 0x000000010000a4e5 nginx`ngx_add_path(cf=0x00007fff5fbff4f0, slot=0x00000000010263d0) + 21 at ngx_file.c:497, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1 4.1
* frame #0: 0x000000010000a4e5 nginx`ngx_add_path(cf=0x00007fff5fbff4f0, slot=0x00000000010263d0) + 21 at ngx_file.c:497
frame #1: 0x000000010000a757 nginx`ngx_conf_merge_path_value(cf=0x00007fff5fbff4f0, path=0x00000000010263d0, prev=<unavailable>, init=0x00000001000c28c0) + 215 at ngx_file.c:421
frame #2: 0x00000001000644d0 nginx`ngx_http_proxy_merge_loc_conf(cf=0x00007fff5fbff4f0, parent=0x00000000010265b8, child=0x0000000001026310) + 800 at ngx_http_proxy_module.c:2678
frame #3: 0x0000000100099d5e nginx`ngx_http_lua_init_worker(cycle=0x0000000001001c50) + 558 at ngx_http_lua_initworkerby.c:116
frame #4: 0x00000001000223de nginx`ngx_single_process_cycle(cycle=0x0000000001001c50) + 62 at ngx_process_cycle.c:305
frame #5: 0x0000000100001f76 nginx`main(argc=<unavailable>, argv=<unavailable>) + 2534 at nginx.c:404
这是在发生错误的bt
—
Good day!
ruoshan