Hello!
On Thu, Sep 4, 2014 at 7:27 AM, muteblinddeaf wrote:
> 2014/09/04 10:12:11 [error] 22686#0: *3 lua entry thread aborted: runtime
> error: /etc/nginx/token.lua:1: module 'resty.redis' not found:
> no field package.preload['resty.redis']
> no file './resty/redis.lua'
Two common possibilities for such errors:
1. Your lua_package_path or lua_package_cpath directives are
configured in the wrong way.
2. The system account running your nginx worker processes (usually
being the "nobody" account) does not have enough permissions to read
the library file(s).
> I also downloaded this:
> https://github.com/openresty/lua-resty-redis/blob/master/lib/resty/redis.lua
> and included it like this with proper path but no luck.
>
> lua_package_path "/path/to/redis.lua;;";
>
It's not sufficient to download a single .lua file. You need to clone
the whole repos, say, in /tmp/lua-resty-redis. Then you should
configure the lua_package_path directive this way:
lua_package_path "/tmp/lua-resty-redis/lib/?.lua;;";
Put this line as-is, do not replace the question mark ("?") to
anything else yourself because the question mark char is a wildcard
meaningful to the Lua VM.
To prevent all such troubles, you're highly recommended to use the
OpenResty bundle where lua-resty-redis (and many other things) just
work out of the box for you:
http://openresty.org/#Download
Regards,
-agentzh