nginx配置信息:
/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.10.2
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
configure arguments: --user=daemon --group=daemon --prefix=/usr/local/nginx/ --with-ld-opt=-Wl,-rpath,/usr/local/lj2/lib/ --with-http_stub_status_module --with-http_sub_module --with-http_gzip_static_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --add-module=../ngx_devel_kit-0.3.0/ --add-module=../lua-nginx-module-0.10.7/ --add-module=../lua-upstream-nginx-module --with-ld-opt=-Wl,-rpath,
报错信息
module 'ngx.upstream' not found:
no field package.preload['ngx.upstream']
no file '/usr/local/nginx/conf/ngx/upstream.lua'
no file '/usr/share/lua/5.1/ngx/upstream.lua'
no file '/usr/local/share/lua/5.1/ngx/upstream.lua'
no file '/usr/local/nginx/ngx/upstream.lua'
no file './ngx/upstream.lua'
no file '/usr/local/share/luajit-2.0.4/ngx/upstream.lua'
no file '/usr/local/share/lua/5.1/ngx/upstream.lua'
no file '/usr/local/share/lua/5.1/ngx/upstream/init.lua'
no file '/usr/local/nginx/conf/ngx/upstream.so'
no file '/usr/share/lua/5.1/ngx/upstream.so'
no file '/usr/local/share/lua/5.1/ngx/upstream.so'
no file '/usr/local/nginx/ngx/upstream.so'
no file './ngx/upstream.so'
no file '/usr/local/lib/lua/5.1/ngx/upstream.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/local/nginx/conf/ngx.so'
no file '/usr/share/lua/5.1/ngx.so'
no file '/usr/local/share/lua/5.1/ngx.so'
no file '/usr/local/nginx/ngx.so'
no file './ngx.so'
no file '/usr/local/lib/lua/5.1/ngx.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
nginx源码目录:
/nginx-1.10.2/objs/addon/src$ ls
ndk.o ngx_http_lua_headers_out.o ngx_http_lua_sleep.o
ngx_http_lua_accessby.o ngx_http_lua_initby.o ngx_http_lua_socket_tcp.o
ngx_http_lua_api.o ngx_http_lua_initworkerby.o ngx_http_lua_socket_udp.o
ngx_http_lua_args.o ngx_http_lua_lex.o ngx_http_lua_ssl_certby.o
ngx_http_lua_balancer.o ngx_http_lua_logby.o ngx_http_lua_ssl.o
ngx_http_lua_bodyfilterby.o ngx_http_lua_log.o ngx_http_lua_ssl_ocsp.o
ngx_http_lua_cache.o ngx_http_lua_misc.o ngx_http_lua_ssl_session_fetchby.o
ngx_http_lua_capturefilter.o ngx_http_lua_module.o ngx_http_lua_ssl_session_storeby.o
ngx_http_lua_clfactory.o ngx_http_lua_ndk.o ngx_http_lua_string.o
ngx_http_lua_config.o ngx_http_lua_output.o ngx_http_lua_subrequest.o
ngx_http_lua_consts.o ngx_http_lua_pcrefix.o ngx_http_lua_time.o
ngx_http_lua_contentby.o ngx_http_lua_phase.o ngx_http_lua_timer.o
ngx_http_lua_control.o ngx_http_lua_regex.o ngx_http_lua_upstream_module.o
ngx_http_lua_coroutine.o ngx_http_lua_req_body.o ngx_http_lua_uri.o
ngx_http_lua_ctx.o ngx_http_lua_req_method.o ngx_http_lua_uthread.o
ngx_http_lua_directive.o ngx_http_lua_rewriteby.o ngx_http_lua_util.o
ngx_http_lua_exception.o ngx_http_lua_script.o ngx_http_lua_variable.o
ngx_http_lua_headerfilterby.o ngx_http_lua_semaphore.o ngx_http_lua_worker.o
ngx_http_lua_headers_in.o ngx_http_lua_setby.o
ngx_http_lua_headers.o ngx_http_lua_shdict.o
按照 春哥, https://github.com/openresty/lua-upstream-nginx-module#get_upstreams 里的加module, 但一直报错,find了全盘,也没有找到 upstream.lua或upstream.so, 在nginx源码下,有.o文件。 测试lua是复制的github上的content_by_lua_block段内容。
有人知道怎么弄么? path或cpath要加什么?