lukaszczerpak / akamai-g2o-lua

Akamai Signature Header Authentication (G2O) for HAProxy, NGINX, Apache and other servers supporting LUA language.
MIT License
8 stars 2 forks source link

Doesn't work on Ubuntu 18.04 #1

Closed lukaszczerpak closed 5 years ago

lukaszczerpak commented 5 years ago

Error seen in logs:

2019/03/01 12:02:53 [error] 2711#2711: init_by_lua error: init_by_lua:1: module '/etc/nginx/akamai-g2o-nginx-wrapper' not found:
        no field package.preload['/etc/nginx/akamai-g2o-nginx-wrapper']
        no file './/etc/nginx/akamai-g2o-nginx-wrapper.lua'
        no file '/usr/share/luajit-2.1.0-beta3//etc/nginx/akamai-g2o-nginx-wrapper.lua'
        no file '/usr/local/share/lua/5.1//etc/nginx/akamai-g2o-nginx-wrapper.lua'
        no file '/usr/local/share/lua/5.1//etc/nginx/akamai-g2o-nginx-wrapper/init.lua'
        no file '/usr/share/lua/5.1//etc/nginx/akamai-g2o-nginx-wrapper.lua'
        no file '/usr/share/lua/5.1//etc/nginx/akamai-g2o-nginx-wrapper/init.lua'
        no file './/etc/nginx/akamai-g2o-nginx-wrapper.so'
        no file '/usr/local/lib/lua/5.1//etc/nginx/akamai-g2o-nginx-wrapper.so'
        no file '/usr/lib/x86_64-linux-gnu/lua/5.1//etc/nginx/akamai-g2o-nginx-wrapper.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        init_by_lua:1: in main chunk
lukaszczerpak commented 5 years ago

Temporary workaround => copy *.lua files to /usr/local/share/lua/5.1/.

lukaszczerpak commented 5 years ago

The solution is that lua_package_path must be set under http section in nginx.conf file:

http {
    ....
    lua_package_path "/etc/nginx/lua/?.lua;;";
    init_by_lua_block { require "akamai-g2o-nginx-wrapper" }
}