diego-treitos / nginx_cache_multipurge

31 stars 12 forks source link

cache_multipurge.lua:6: module 'md5' not found #1

Closed ramonli closed 4 years ago

ramonli commented 4 years ago

I have installed lua-md5:

[hzinsops@do-dmz-p-26 ~]$ sudo yum install libnginx-mod-http-lua lua-md5 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile No package libnginx-mod-http-lua available. Package lua-md5-1.1.2-1.el7.x86_64 already installed and latest version Nothing to do

however when do purge, nginx throw below errors:

*145 lua entry thread aborted: runtime error: /etc/nginx/luaconf/cache_multipurge.lua:6: module 'md5' not found:

My environment:

Please help.

diego-treitos commented 4 years ago

I think it is possible that you have included a lua_package_path statement wrong. What is the value that you set for lua_package_path?

ramonli commented 4 years ago

Below are my lua related directives:

lua_need_request_body on; lua_package_path "/etc/nginx/luaconf/?.lua;;"; lua_shared_dict limit 500m; init_by_lua_file /etc/nginx/luaconf/init.lua; log_by_lua_file /etc/nginx/luaconf/log.lua; access_by_lua_file /etc/nginx/luaconf/waf.lua;

diego-treitos commented 4 years ago

Ok. To be clear this is not a problem with this module but with lua finding the packages. The lua_package_path looks good, as it contains the ;; at the end.

You should be able to see where the md5.lua file is stored with this command:

rpm -ql lua-md5

Then, you can check your lua package paths with: lua -e 'print(package.path)'

This way you can confirm that the md5.lua file is inside a directory that is inside your package paths. If not, you can always copy the md5.lua file to /etc/nginx/luaconf/ directory and everything should work.